diff mbox series

[4/4] fixup "libmultipath: use libmp_pathinfo() in update_multipath_table()"

Message ID 20240718191421.110487-5-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools: coverity fixes | expand

Commit Message

Martin Wilck July 18, 2024, 7:14 p.m. UTC
We need to check for NULL before dereferencing mpp.
Found by coverity.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/structs_vec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 731b1bc..d58ef5a 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -504,11 +504,12 @@  update_multipath_table (struct multipath *mpp, vector pathvec, int flags)
 	int r = DMP_ERR;
 	char __attribute__((cleanup(cleanup_charp))) *params = NULL;
 	char __attribute__((cleanup(cleanup_charp))) *status = NULL;
-	unsigned long long size = mpp->size;
+	unsigned long long size;
 
 	if (!mpp)
 		return r;
 
+	size = mpp->size;
 	r = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_MPATH_ONLY,
 			  (mapid_t) { .str = mpp->alias },
 			  (mapinfo_t) {