[dpdk-stable] patch 'kni: fix build with gcc 8.1' has been queued to LTS release 17.11.4

Yongseok Koh yskoh at mellanox.com
Fri Jul 27 04:09:12 CEST 2018


Hi,

FYI, your patch has been queued to LTS release 17.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/28/18. So please
shout if anyone has objections.

Thanks.

Yongseok

---
>From e9106897f3d7ca13353df6ddea61f1c68a829ad3 Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <ferruh.yigit at intel.com>
Date: Tue, 26 Jun 2018 12:38:07 +0100
Subject: [PATCH] kni: fix build with gcc 8.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit a36b40dd8ecfb61648045e418551f75055ca77f9 ]

Error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option is
enabled.

build error:
In function ‘strncpy’,
    inlined from ‘igb_get_drvinfo’ at
    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 using strlcpy instead of strncpy.

adapter->fw_version size kept same because of
c3698192940c ("kni: fix build with gcc 7.1")

Also next line strncpy usage replaced with strlcpy while arround.

Fixes: c3698192940c ("kni: fix build with gcc 7.1")

Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
index 95e262b78..aed14bcc8 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_ethtool.c
@@ -826,9 +826,10 @@ static void igb_get_drvinfo(struct net_device *netdev,
 	strncpy(drvinfo->driver,  igb_driver_name, sizeof(drvinfo->driver) - 1);
 	strncpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version) - 1);
 
-	strncpy(drvinfo->fw_version, adapter->fw_version,
-		sizeof(drvinfo->fw_version) - 1);
-	strncpy(drvinfo->bus_info, pci_name(adapter->pdev), sizeof(drvinfo->bus_info) -1);
+	strlcpy(drvinfo->fw_version, adapter->fw_version,
+		sizeof(drvinfo->fw_version));
+	strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
+		sizeof(drvinfo->bus_info));
 	drvinfo->n_stats = IGB_STATS_LEN;
 	drvinfo->testinfo_len = IGB_TEST_LEN;
 	drvinfo->regdump_len = igb_get_regs_len(netdev);
-- 
2.11.0



More information about the stable mailing list