summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorChen Zhou <chenzhou10@huawei.com>2020-01-20 13:49:43 +0100
committerDavid S. Miller <davem@davemloft.net>2020-01-21 10:48:17 +0100
commit49e211c0e357d8c5ccdc3c6c5fb8f94ab85d037f (patch)
tree607cf2d8871be593e4f8122170d708945ac3e72e /drivers/net
parentMerge tag 'rds-odp-for-5.5' of https://git.kernel.org/pub/scm/linux/kernel/gi... (diff)
downloadlinux-49e211c0e357d8c5ccdc3c6c5fb8f94ab85d037f.tar.xz
linux-49e211c0e357d8c5ccdc3c6c5fb8f94ab85d037f.zip
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index 6b328a259efc..92ee1f5cf31f 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -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);