From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 82DEF1D01F for ; Sun, 13 May 2018 05:26:55 +0200 (CEST) From: Andy Green To: dev@dpdk.org References: <152618185248.125230.3244687143464768033.stgit@localhost.localdomain> Message-ID: Date: Sun, 13 May 2018 11:26:50 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 In-Reply-To: <152618185248.125230.3244687143464768033.stgit@localhost.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] bus/ifpga: fix strncpy with wrong length with strlcpy 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: Sun, 13 May 2018 03:26:55 -0000 On 05/13/2018 11:24 AM, Andy Green wrote: > In function ‘ifpga_scan_one’, > inlined from ‘ifpga_scan’ at /home/agreen/projects/ > lagopus/src/dpdk/drivers/bus/ifpga/ifpga_bus.c:229:13: > /home/agreen/projects/lagopus/src/dpdk/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)); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~~ > > Signed-off-by: Andy Green > Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library") > --- > drivers/bus/ifpga/ifpga_bus.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c > index 16b7e06b6..08b3c8fdd 100644 > --- a/drivers/bus/ifpga/ifpga_bus.c > +++ b/drivers/bus/ifpga/ifpga_bus.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -158,7 +159,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)){ > Never mind... I just saw Pablo's patch from yesterday when checking this went through, ignore this one.