net: hns: optimizate fmt of snprintf()
authorQianqian Xie <xieqianqian@huawei.com>
Thu, 24 Mar 2016 11:08:01 +0000 (19:08 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Mar 2016 18:33:06 +0000 (14:33 -0400)
It misses string format in function snprintf(), as below:
snprintf(buff, ETH_GSTRING_LEN, g_gmac_stats_string[i].desc);

It needs to add "%s" to fix it as below:
snprintf(buff, ETH_GSTRING_LEN, "%s", g_gmac_stats_string[i].desc);

Signed-off-by: Qianqian Xie <xieqianqian@huawei.com>
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c

index 6e2b76ede0751048380820851bdd3f42879cb965..44abb08de155c2d7ef05f5539376ad5581ef229c 100644 (file)
@@ -664,7 +664,8 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data)
                return;
 
        for (i = 0; i < ARRAY_SIZE(g_gmac_stats_string); i++) {
-               snprintf(buff, ETH_GSTRING_LEN, g_gmac_stats_string[i].desc);
+               snprintf(buff, ETH_GSTRING_LEN, "%s",
+                        g_gmac_stats_string[i].desc);
                buff = buff + ETH_GSTRING_LEN;
        }
 }