mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-11 01:00:57 +00:00
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: Chen Zhou <chenzhou10@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ad063075d4
commit
49e211c0e3
1 changed files with 2 additions and 2 deletions
|
@ -297,8 +297,8 @@ 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",
|
||||
"Please echo help to cmd to get help information");
|
||||
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);
|
||||
|
||||
kfree(buf);
|
||||
|
|
Loading…
Add table
Reference in a new issue