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 36B2D1CC12 for ; Sat, 12 May 2018 03:48:18 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Sat, 12 May 2018 09:48:14 +0800 Message-ID: <152608969441.121204.15215330814846057280.stgit@localhost.localdomain> In-Reply-To: <152608956198.121204.14844325841690943774.stgit@localhost.localdomain> References: <152608956198.121204.14844325841690943774.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH v5 06/16] net/nfp/nfpcore: solve strncpy misuse 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 01:48:18 -0000 Signed-off-by: Andy Green Acked-by: Alejandro Lucero Tested-by: Alejandro Lucero Fixes: c7e9729da6b5 ("net/nfp: support CPP") --- drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c index 4e6c66624..52b294888 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c @@ -31,6 +31,8 @@ #include #include +#include + #include "nfp_cpp.h" #include "nfp_target.h" #include "nfp6000/nfp6000.h" @@ -846,7 +848,7 @@ nfp6000_init(struct nfp_cpp *cpp, const char *devname) memset(desc->busdev, 0, BUSDEV_SZ); - strncpy(desc->busdev, devname, strlen(devname)); + strlcpy(desc->busdev, devname, sizeof(desc->busdev)); ret = nfp_acquire_process_lock(desc); if (ret)