patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] kni: fix build with gcc 8.1
@ 2018-06-19 12:08 Ferruh Yigit
  2018-06-19 23:35 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ferruh Yigit @ 2018-06-19 12:08 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, stable

Error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option is
enabled.

build error:
In function ‘strncpy’,
    inlined from ‘igb_get_drvinfo’ at
    .../dpdk/build/build/kernel/linux/kni/igb_ethtool.c:814:2:
    .../include/linux/string.h:246:9: error: ‘__builtin_strncpy’ output
    may be truncated copying 31 bytes from a string of length 42
    [-Werror=stringop-truncation]
      return __builtin_strncpy(p, q, size);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixed by reducing the adapter->fw_version size and adjusting strncpy
limit size.

Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 kernel/linux/kni/ethtool/igb/igb.h         | 2 +-
 kernel/linux/kni/ethtool/igb/igb_ethtool.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/linux/kni/ethtool/igb/igb.h b/kernel/linux/kni/ethtool/igb/igb.h
index 8aa2a3088..5e798ae83 100644
--- a/kernel/linux/kni/ethtool/igb/igb.h
+++ b/kernel/linux/kni/ethtool/igb/igb.h
@@ -592,7 +592,7 @@ struct igb_adapter {
 	int int_mode;
 	u32 rss_queues;
 	u32 vmdq_pools;
-	char fw_version[43];
+	char fw_version[32];
 	u32 wvbr;
 	struct igb_mac_addr *mac_table;
 #ifdef CONFIG_IGB_VMDQ_NETDEV
diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
index 064528bcf..0b8b25ff1 100644
--- a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
+++ b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
@@ -812,7 +812,7 @@ static void igb_get_drvinfo(struct net_device *netdev,
 	strncpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version) - 1);
 
 	strncpy(drvinfo->fw_version, adapter->fw_version,
-		sizeof(drvinfo->fw_version) - 1);
+		sizeof(drvinfo->fw_version));
 	strncpy(drvinfo->bus_info, pci_name(adapter->pdev), sizeof(drvinfo->bus_info) -1);
 	drvinfo->n_stats = IGB_STATS_LEN;
 	drvinfo->testinfo_len = IGB_TEST_LEN;
-- 
2.17.1

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

end of thread, other threads:[~2018-06-27 13:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 12:08 [dpdk-stable] [PATCH] kni: fix build with gcc 8.1 Ferruh Yigit
2018-06-19 23:35 ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
2018-06-20 16:39   ` Ferruh Yigit
2018-06-20 17:04     ` Ferruh Yigit
2018-06-20  9:01 ` [dpdk-stable] " De Lara Guarch, Pablo
2018-06-20 16:40   ` Ferruh Yigit
2018-06-26  9:02 ` [dpdk-stable] [PATCH v2] " Ferruh Yigit
2018-06-26  9:54   ` Thomas Monjalon
2018-06-26 11:38   ` [dpdk-stable] [PATCH v3] " Ferruh Yigit
2018-06-26 13:43     ` De Lara Guarch, Pablo
2018-06-27 13:15       ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).