Skip to content

Commit 49e211c

Browse files
Chen Zhoudavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ad06307 commit 49e211c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer,
297297
if (!buf)
298298
return -ENOMEM;
299299

300-
len = snprintf(buf, HNS3_DBG_READ_LEN, "%s\n",
301-
"Please echo help to cmd to get help information");
300+
len = scnprintf(buf, HNS3_DBG_READ_LEN, "%s\n",
301+
"Please echo help to cmd to get help information");
302302
uncopy_bytes = copy_to_user(buffer, buf, len);
303303

304304
kfree(buf);

0 commit comments

Comments
 (0)