From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] kni: fix build with gcc 8.1 Date: Tue, 19 Jun 2018 16:35:36 -0700 Message-ID: <20180619163536.2da8e683@xeon-e3> References: <20180619120855.78207-1-ferruh.yigit@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org, stable@dpdk.org To: Ferruh Yigit Return-path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id 15FA01B058 for ; Wed, 20 Jun 2018 01:35:48 +0200 (CEST) Received: by mail-pf0-f194.google.com with SMTP id w7-v6so613438pfn.9 for ; Tue, 19 Jun 2018 16:35:47 -0700 (PDT) In-Reply-To: <20180619120855.78207-1-ferruh.yigit@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 19 Jun 2018 13:08:55 +0100 Ferruh Yigit wrote: > Error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option is > enabled. >=20 > build error: > In function =E2=80=98strncpy=E2=80=99, > inlined from =E2=80=98igb_get_drvinfo=E2=80=99 at > .../dpdk/build/build/kernel/linux/kni/igb_ethtool.c:814:2: > .../include/linux/string.h:246:9: error: =E2=80=98__builtin_strncpy= =E2=80=99 output > may be truncated copying 31 bytes from a string of length 42 > [-Werror=3Dstringop-truncation] > return __builtin_strncpy(p, q, size); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > Fixed by reducing the adapter->fw_version size and adjusting strncpy > limit size. >=20 > Cc: stable@dpdk.org >=20 > Signed-off-by: Ferruh Yigit > --- > kernel/linux/kni/ethtool/igb/igb.h | 2 +- > kernel/linux/kni/ethtool/igb/igb_ethtool.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/kernel/linux/kni/ethtool/igb/igb.h b/kernel/linux/kni/ethtoo= l/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]; Use ETHTOOL_FWVERS_LEN? > 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/kn= i/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); > =20 > strncpy(drvinfo->fw_version, adapter->fw_version, > - sizeof(drvinfo->fw_version) - 1); > + sizeof(drvinfo->fw_version)); Why not: strlcpy(drvinfo->fw_version, adapter->fw_version, sizeof(drvinfo->fw_version));