[dpdk-dev] [PATCH] bus/pci: fix driver name string manipulation

Jerin Jacob jerin.jacob at caviumnetworks.com
Tue May 15 12:03:35 CEST 2018


sizeof(dri_name) is 8B on 64Bit systems.The intended operation is coping
the string after '/' from the string `name`.

This bug is not letting to probe any device string >8B hence results in
the testpmd error("No ethernet devices found) on some PMDs.

Cc: Andy Green <andy at warmcat.com>
Cc: Pablo de Lara <pablo.de.lara.guarch at intel.com>

Fixes: fe5f777b538 ("bus/pci: replace strncpy by strlcpy")

Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
---
 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 a73ee49c2..cd45875b1 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));
 		return 0;
 	}
 
-- 
2.17.0



More information about the dev mailing list