mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] net: hns3: replace snprintf with scnprintf in hns3_dbg_cmd_read
@ 2020-01-19 12:41 Chen Zhou
  2020-01-20  1:28 ` tanhuazhong
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Zhou @ 2020-01-19 12:41 UTC (permalink / raw)
  To: yisen.zhuang, salil.mehta, davem; +Cc: netdev, linux-kernel, chenzhou10

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>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index 6b328a2..8fad699 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -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);
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-20  2:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 12:41 [PATCH -next] net: hns3: replace snprintf with scnprintf in hns3_dbg_cmd_read Chen Zhou
2020-01-20  1:28 ` tanhuazhong
2020-01-20  2:37   ` Chen Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®