[PATCH 01/42] libmultipath: Invalid check for mpp->wwid in dm_addmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mpp->wwid is an array, and so a check against NULL
is wrong; we need to use strlen here.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 libmultipath/devmapper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index de7d446..5132399 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -281,7 +281,7 @@ dm_addmap (int task, const char *target, struct multipath *mpp, char * params,
 	if (ro)
 		dm_task_set_ro(dmt);
 
-	if (use_uuid && mpp->wwid){
+	if (use_uuid && strlen(mpp->wwid) > 0){
 		prefixed_uuid = MALLOC(UUID_PREFIX_LEN + strlen(mpp->wwid) + 1);
 		if (!prefixed_uuid) {
 			condlog(0, "cannot create prefixed uuid : %s\n",
-- 
1.7.4.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel


[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux