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 8ECA08DAD for ; Tue, 15 May 2018 09:31:18 +0200 (CEST) From: Andy Green To: dev@dpdk.org Cc: lei.a.yao@intel.com Date: Tue, 15 May 2018 15:31:00 +0800 Message-ID: <152636946035.95095.1840276672620244597.stgit@localhost.localdomain> In-Reply-To: <2DBBFF226F7CF64BAFCA79B681719D953A44992E@SHSMSX101.ccr.corp.intel.com> References: <2DBBFF226F7CF64BAFCA79B681719D953A44992E@SHSMSX101.ccr.corp.intel.com> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH] bus/pci: correct the earlier strlcpy conversion 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: Tue, 15 May 2018 07:31:18 -0000 Fixes: fe5f777b5383 ("bus/pci: replace strncpy by strlcpy") Signed-off-by: Andy Green --- drivers/bus/pci/linux/pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index a73ee49c2..004600f1c 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -33,7 +33,8 @@ extern struct rte_pci_bus rte_pci_bus; static int -pci_get_kernel_driver_by_path(const char *filename, char *dri_name) +pci_get_kernel_driver_by_path(const char *filename, char *dri_name, + size_t len) { int count; char path[PATH_MAX]; @@ -54,7 +55,7 @@ pci_get_kernel_driver_by_path(const char *filename, char *dri_name) name = strrchr(path, '/'); if (name) { - strlcpy(dri_name, name + 1, sizeof(dri_name)); + strlcpy(dri_name, name + 1, len); return 0; } @@ -314,7 +315,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) /* parse driver */ snprintf(filename, sizeof(filename), "%s/driver", dirname); - ret = pci_get_kernel_driver_by_path(filename, driver); + ret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver)); if (ret < 0) { RTE_LOG(ERR, EAL, "Fail to get kernel driver\n"); free(dev);