summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/hisilicon/hns3
diff options
context:
space:
mode:
authorGuojia Liao <liaoguojia@huawei.com>2020-01-21 16:42:09 +0800
committerDavid S. Miller <davem@davemloft.net>2020-01-21 11:46:21 +0100
commitcdc37385e3abaf2704adf8bb15a2c14f04762d3d (patch)
tree630ce0b1326ffe436fd9deb54efe1fc0b026243c /drivers/net/ethernet/hisilicon/hns3
parent9027d043fc31145918b40b7a68956eaff4ddb5de (diff)
downloadlinux-cdc37385e3abaf2704adf8bb15a2c14f04762d3d.tar.gz
linux-cdc37385e3abaf2704adf8bb15a2c14f04762d3d.tar.bz2
linux-cdc37385e3abaf2704adf8bb15a2c14f04762d3d.zip
net: hns3: refine the input parameter 'size' for snprintf()
The function snprintf() writes at most size bytes (including the terminating null byte ('\0') to str. Now, We can guarantee that the parameter of size is lager than the length of str to be formatting including its terminating null byte. So it's unnecessary to minus 1 for the input parameter 'size'. Signed-off-by: Guojia Liao <liaoguojia@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_enet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 06c58ed3c45e..6271b693ddad 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -4716,7 +4716,7 @@ static int __init hns3_init_module(void)
pr_info("%s: %s\n", hns3_driver_name, hns3_copyright);
client.type = HNAE3_CLIENT_KNIC;
- snprintf(client.name, HNAE3_CLIENT_NAME_LENGTH - 1, "%s",
+ snprintf(client.name, HNAE3_CLIENT_NAME_LENGTH, "%s",
hns3_driver_name);
client.ops = &client_ops;