From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id A9DAE1CD94 for ; Sat, 12 May 2018 09:02:00 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 May 2018 00:01:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,391,1520924400"; d="scan'208";a="38731703" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by fmsmga007.fm.intel.com with ESMTP; 12 May 2018 00:01:58 -0700 From: Pablo de Lara To: thomas@monjalon.net, rosen.xu@intel.com Cc: dev@dpdk.org, Pablo de Lara Date: Sat, 12 May 2018 08:02:17 +0100 Message-Id: <20180512070217.16735-1-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] bus/fpga: use strlcpy instead of strncpy 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: Sat, 12 May 2018 07:02:01 -0000 Gcc 8 reports a build error: drivers/bus/ifpga/ifpga_bus.c:161:2: error: ‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation] strncpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Signed-off-by: Pablo de Lara --- drivers/bus/ifpga/ifpga_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 16b7e06b6..45597a1bb 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -20,10 +20,10 @@ #include #include #include - #include #include #include +#include #include "rte_rawdev.h" #include "rte_rawdev_pmd.h" @@ -158,7 +158,7 @@ ifpga_scan_one(struct rte_rawdev *rawdev, rawdev->dev_ops->dev_start(rawdev)) goto free_dev; - strncpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path)); + strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path)); if (rawdev->dev_ops->firmware_load && rawdev->dev_ops->firmware_load(rawdev, &afu_pr_conf)){ -- 2.17.0