libmultipath: Invalid check for mpp->wwid in dm_addmap()
authorHannes Reinecke <hare@suse.de>
Tue, 8 Jan 2013 13:53:39 +0000 (14:53 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 8 Jan 2013 22:16:39 +0000 (23:16 +0100)
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@suse.de>
libmultipath/devmapper.c

index de7d446..5132399 100644 (file)
@@ -281,7 +281,7 @@ dm_addmap (int task, const char *target, struct multipath *mpp, char * params,
        if (ro)
                dm_task_set_ro(dmt);
 
        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",
                prefixed_uuid = MALLOC(UUID_PREFIX_LEN + strlen(mpp->wwid) + 1);
                if (!prefixed_uuid) {
                        condlog(0, "cannot create prefixed uuid : %s\n",