From d01493feca50fbd06e09f674e9da4e249430fd2d Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Wed, 1 Jun 2022 21:13:58 -0700 Subject: [PATCH] LU-15220 lipe: avoid gcc-11 -Werror=stringop-truncation warning This patch fixes -Werror=stringop-truncation warnings in lipe codes. Test-Parameters: trivial testlist=sanity-lipe Change-Id: Ie007083b1fe94d81e3772d7c0947457d2c3042ac Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/47510 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond --- lipe/src/policy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lipe/src/policy.c b/lipe/src/policy.c index ca7d56c..5e14645 100644 --- a/lipe/src/policy.c +++ b/lipe/src/policy.c @@ -516,10 +516,10 @@ int lipe_rule_add(struct lipe_policy *policy, struct lipe_rule_group *group, if (action_counter_name != NULL) strncpy(rule->lr_counter_name, action_counter_name, - sizeof(rule->lr_counter_name)); + sizeof(rule->lr_counter_name) - 1); else if (action_type == LAT_COUNTER_INC && action_argument != NULL) strncpy(rule->lr_counter_name, action_argument, - sizeof(rule->lr_counter_name)); + sizeof(rule->lr_counter_name) - 1); else { LERROR("no counter name or argument is given for action [%s]\n", action_string); -- 1.8.3.1