From: Jian Yu Date: Thu, 2 Jun 2022 04:13:58 +0000 (-0700) Subject: LU-15220 lipe: avoid gcc-11 -Werror=stringop-truncation warning X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d01493feca50fbd06e09f674e9da4e249430fd2d;p=fs%2Flustre-release.git 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 --- 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);