From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZJJAj+n1E2T1XwGYp4VAvsrr2abU4+gZFcv753liXUw=; b=tgWPM2mp8qLp33d7EcEfRUtQOni0ekWcoUGv992tSSNx1cOiamr5ZU/+an5eOIFDGM g0VzsHCL5EcAK8K9BqIirVhw4HW/kK8d/6KoX5eb+AMl/Z7/HpqKnc4MxmATEPLONEEr W3O0SR5FRHKzzSWWewusY38lMUK49VowV4RbRo8I/c3GNx+AR4/zT50kn7yn3bT0OBc7 ynInxq3U+rVnNY5X7l6UtpnzzPbtEHthENwlQq17rCiuptUjJ4VT6AnQejvjDAl1TvrI R3gtBlHOw4gcuDlmSZL1hBuLl5VEyfLDgHDja/ixwWB9J6difcTfw5crWzlYkzuKY2EJ mYGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZJJAj+n1E2T1XwGYp4VAvsrr2abU4+gZFcv753liXUw=; b=dOV7ykvYSHgjzTQM1SLD5BMPnaaeejwWoUym3hOZzbLJXxmZ5qlQOWvMitI72UBeTU ZmpPwOS+dPEaVV+jGQhDVr1dLRLnIqw8fRJfVV/ImXGMud7kCI/hgPQiGZBdfd182ACr 8iVtKSHuWXGULQBMSQLdL4scESFjiMdjPBP386Yy0yeIFizERSzqrcNHwKEwwStv6545 NOWgtFS2jS27lx1YG6CbhZKtFSH5iklzHIwnYGnBcY320wbwLUPBNP89YLhYqaNiIqGJ UeVPgFiy3wbYBI+ZFdA180fN5E1kk3s16NN0M2QwZ8TYIyOHzigkJtL0nJay1Gx/4+JE /xGA== X-Gm-Message-State: APt69E2YoghwmCniaNDHt+OH9TvxRQoSXkPQw+91+u5Sd5EsuL0qf2Fx otMxOtOUv4IRmmIDVtVZFeOTUQ== X-Google-Smtp-Source: ADUXVKJ/ktPZunvnxfV+LtEyJmA5d1qLMbWKJXBVscuRNZdHA+YAsIQiAS0GTT9iZUu4YhR0m7AUNA== X-Received: by 2002:a65:6390:: with SMTP id h16-v6mr16744563pgv.382.1529451347202; Tue, 19 Jun 2018 16:35:47 -0700 (PDT) Received: from xeon-e3 (204-195-35-107.wavecable.com. [204.195.35.107]) by smtp.gmail.com with ESMTPSA id 63-v6sm1167033pfo.1.2018.06.19.16.35.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 16:35:47 -0700 (PDT) Date: Tue, 19 Jun 2018 16:35:36 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: dev@dpdk.org, stable@dpdk.org Message-ID: <20180619163536.2da8e683@xeon-e3> In-Reply-To: <20180619120855.78207-1-ferruh.yigit@intel.com> References: <20180619120855.78207-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH] kni: fix build with gcc 8.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2018 23:35:48 -0000 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));