From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 17F9E5424 for ; Thu, 3 Jan 2019 09:26:53 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Jan 2019 10:26:48 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x038Qiqh002007; Thu, 3 Jan 2019 10:26:47 +0200 From: Yongseok Koh To: alejandro.lucero@netronome.com, cristian.dumitrescu@intel.com Cc: stable@dpdk.org Date: Thu, 3 Jan 2019 00:26:27 -0800 Message-Id: <20190103082627.17224-2-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190103082627.17224-1-yskoh@mellanox.com> References: <20190103082627.17224-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH 17.11 2/2] net/nfp: replace strncpy by strlcpy X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2019 08:26:53 -0000 GCC 8.1 error: drivers/net/nfp/nfp_nspu.c: In function ‘nfp_nspu_set_bar_from_symbl.constprop’: drivers/net/nfp/nfp_nspu.c:426:2: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy(sym_buf, symbl, strlen(symbl)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: dd63df2bfff3 ("net/nfp: add NSP symbol resolution command") Cc: alejandro.lucero@netronome.com Signed-off-by: Yongseok Koh --- drivers/net/nfp/nfp_nspu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfp_nspu.c b/drivers/net/nfp/nfp_nspu.c index f90898321..ac5bce3b1 100644 --- a/drivers/net/nfp/nfp_nspu.c +++ b/drivers/net/nfp/nfp_nspu.c @@ -9,6 +9,7 @@ #include #include +#include #include "nfp_nfpu.h" @@ -423,7 +424,7 @@ nfp_nspu_set_bar_from_symbl(nspu_desc_t *desc, const char *symbl, if (!sym_buf) return -ENOMEM; - strncpy(sym_buf, symbl, strlen(symbl)); + strlcpy(sym_buf, symbl, sizeof(sym_buf)); ret = nspu_command(desc, NSP_CMD_GET_SYMBOL, 1, 1, sym_buf, NFP_SYM_DESC_LEN, strlen(symbl)); if (ret) { -- 2.11.0