Commit 49e211c0 authored by Chen Zhou's avatar Chen Zhou Committed by David S. Miller

net: hns3: replace snprintf with scnprintf in hns3_dbg_cmd_read

The return value of snprintf may be greater than the size of
HNS3_DBG_READ_LEN, use scnprintf instead in hns3_dbg_cmd_read.
Signed-off-by: default avatarChen Zhou <chenzhou10@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad063075
......@@ -297,7 +297,7 @@ static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer,
if (!buf)
return -ENOMEM;
len = snprintf(buf, HNS3_DBG_READ_LEN, "%s\n",
len = scnprintf(buf, HNS3_DBG_READ_LEN, "%s\n",
"Please echo help to cmd to get help information");
uncopy_bytes = copy_to_user(buffer, buf, len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment