[dm-devel] [PATCH 1/6] libmultipath: check uedv* return value in sysfs_get_host_pci_name
lixiaokeng
lixiaokeng at huawei.com
Tue Sep 15 04:39:15 UTC 2020
udev_device_get_sysname may return NULL. We check the return value.
Signed-off-by:Lixiaokeng<Lixiaokeng at huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26 at huawei.com>
Signed-off-by: Linfeilong <linfeilong at huawei.com>
---
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;
--
More information about the dm-devel
mailing list