From patchwork Tue Jun 19 12:08:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 41267 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F68E37A6; Tue, 19 Jun 2018 13:09:25 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 52E24343C; Tue, 19 Jun 2018 13:09:21 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2018 04:09:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,242,1526367600"; d="scan'208";a="58910740" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by fmsmga002.fm.intel.com with ESMTP; 19 Jun 2018 04:09:18 -0700 From: Ferruh Yigit To: Ferruh Yigit Cc: dev@dpdk.org, stable@dpdk.org Date: Tue, 19 Jun 2018 13:08:55 +0100 Message-Id: <20180619120855.78207-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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;