Skip to content

Commit

Permalink
net: hns3: fix a -Wformat-nonliteral compile warning
Browse files Browse the repository at this point in the history
When setting -Wformat=2, there is a compiler warning like this:

hclge_main.c:xxx:x: warning: format not a string literal and no
format arguments [-Wformat-nonliteral]
strs[i].desc);
^~~~

This patch adds missing format parameter "%s" to snprintf() to
fix it.

Fixes: 46a3df9 ("Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yonglong Liu authored and David S. Miller committed Jun 28, 2019
1 parent 04f25ed commit 18d219b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,7 @@ static u8 *hclge_comm_get_strings(u32 stringset,
return buff;

for (i = 0; i < size; i++) {
snprintf(buff, ETH_GSTRING_LEN,
strs[i].desc);
snprintf(buff, ETH_GSTRING_LEN, "%s", strs[i].desc);
buff = buff + ETH_GSTRING_LEN;
}

Expand Down

0 comments on commit 18d219b

Please sign in to comment.