提交 1b4254ce 编写于 作者: X Xiongfeng Wang 提交者: Corey Minyard

ipmi: use correct string length

gcc-8 reports

drivers/char/ipmi/ipmi_msghandler.c: In function
'panic_op_write_handler':
./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified
bound 16 equals destination size [-Wstringop-truncation]

drivers/char/ipmi/ipmi_watchdog.c: In function 'set_param_str':
./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified
bound 16 equals destination size [-Wstringop-truncation]

We need one less byte or call strlcpy() to make it a nul-terminated
string.
Signed-off-by: NXiongfeng Wang <xiongfeng.wang@linaro.org>
Signed-off-by: NCorey Minyard <cminyard@mvista.com>
上级 174134ac
......@@ -84,7 +84,7 @@ static int panic_op_write_handler(const char *val,
char valcp[16];
char *s;
strncpy(valcp, val, 16);
strncpy(valcp, val, 15);
valcp[15] = '\0';
s = strstrip(valcp);
......
......@@ -232,7 +232,7 @@ static int set_param_str(const char *val, const struct kernel_param *kp)
char valcp[16];
char *s;
strncpy(valcp, val, 16);
strncpy(valcp, val, 15);
valcp[15] = '\0';
s = strstrip(valcp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册