summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-05-14 13:00:06 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-05-14 23:32:23 +0200
commitfe5f777b538301ecadf3fee5c30dd0b289f50c7c (patch)
treee829260c1311e99945f28872ef40623f35bfd91e
parentf5fd98c802e8911513fff217a01d0a61eba86ff1 (diff)
downloaddpdk-fe5f777b538301ecadf3fee5c30dd0b289f50c7c.zip
dpdk-fe5f777b538301ecadf3fee5c30dd0b289f50c7c.tar.gz
dpdk-fe5f777b538301ecadf3fee5c30dd0b289f50c7c.tar.xz
bus/pci: replace strncpy by strlcpy
In function ‘pci_get_kernel_driver_by_path’, inlined from ‘pci_scan_one.isra.1’ at drivers/bus/pci/linux/pci.c:317:8: drivers/bus/pci/linux/pci.c:57:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] strncpy(dri_name, name + 1, strlen(name + 1) + 1); Fixes: d9a8cd9595f2 ("pci: add kernel driver type") Cc: stable@dpdk.org Signed-off-by: Andy Green <andy@warmcat.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
-rw-r--r--drivers/bus/pci/linux/pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 4630a80..a73ee49 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) {
- strncpy(dri_name, name + 1, strlen(name + 1) + 1);
+ strlcpy(dri_name, name + 1, sizeof(dri_name));
return 0;
}