net: hns3: replace snprintf with scnprintf in hns3_dbg_cmd_read
Subsystems (4)
PATCH 1/1 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.
--- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +1 -1
@@ -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);
Signature · 1 line
2.7.4
Quoted 13 lines · Chen Zhou
The return value of snprintf may be greater than the size of
HNS3_DBG_READ_LEN, use scnprintf instead inhns3_dbg_cmd_read.Signed-off-by Chen Zhou <[email protected]>--- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +0
-0
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer, · line 301
Quoted 6 lines
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +1
-1@@ -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" );
not align?
Quoted 3 lines
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +0
-0uncopy_bytes =copy_to_user (buffer, buf, len);
Quoted 11 lines · tanhuazhong
Quoted 8 lines · Chen Zhou
The return value of snprintf may be greater than the size of
HNS3_DBG_READ_LEN, use scnprintf instead inhns3_dbg_cmd_read.Signed-off-by Chen Zhou <[email protected]>--- drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer, · line 301
Quoted 10 lines
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +1
-0@@ -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");not align?
Ok, i will fix in next version.
Thanks,
Chen Zhou
Quoted 7 lines
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer, · line 303
Quoted 3 lines
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +0
-0uncopy_bytes =copy_to_user (buffer, buf, len);.