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: d9a8cd9595
("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>
This commit is contained in:
parent
f5fd98c802
commit
fe5f777b53
@ -54,7 +54,7 @@ pci_get_kernel_driver_by_path(const char *filename, char *dri_name)
|
|||||||
|
|
||||||
name = strrchr(path, '/');
|
name = strrchr(path, '/');
|
||||||
if (name) {
|
if (name) {
|
||||||
strncpy(dri_name, name + 1, strlen(name + 1) + 1);
|
strlcpy(dri_name, name + 1, sizeof(dri_name));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user