udev_device_get_sysname may return NULL. We check the return value. Signed-off-by:Lixiaokeng<Lixiaokeng@xxxxxxxxxx> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx> Signed-off-by: Linfeilong <linfeilong@xxxxxxxxxx> --- libmultipath/discovery.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 3f1b1d71..4264b0da 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -519,6 +519,9 @@ int sysfs_get_host_pci_name(const struct path *pp, char *pci_name) */ value = udev_device_get_sysname(parent); + if (!value) + return 1; + strncpy(pci_name, value, SLOT_NAME_SIZE); udev_device_unref(hostdev); return 0; -- -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel