From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 829871B790; Tue, 15 May 2018 17:00:37 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2018 08:00:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,403,1520924400"; d="scan'208";a="56102588" Received: from dpdk6.bj.intel.com ([172.16.182.201]) by orsmga001.jf.intel.com with ESMTP; 15 May 2018 08:00:34 -0700 From: Wei Dai To: ferruh.yigit@intel.com, anatoly.burakov@intel.com Cc: dev@dpdk.org, Wei Dai , stable@dpdk.org Date: Tue, 15 May 2018 22:40:51 +0800 Message-Id: <1526395251-27894-1-git-send-email-wei.dai@intel.com> X-Mailer: git-send-email 2.7.5 Subject: [dpdk-dev] [PATCH] bus/pci: fix error in parsing vfio driver 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 15:00:38 -0000 In pci_get_kernel_driver_by_path(), the available memory size of dri_name should be strlen(name + 1) + 1, not the size of the pointer (8 bytes), so "vfio-pci" is truncated to "vfio-pc" ended with number 0. This patch fixes it. Fixes: fe5f777b5383 ("bus/pci: replace strncpy by strlcpy") Cc: stable@dpdk.org Signed-off-by: Wei Dai --- drivers/bus/pci/linux/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index a73ee49..cc6b383 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -54,7 +54,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, strlen(name + 1) + 1); return 0; } -- 2.5.5