[dm-devel] [PATCH 01/42] libmultipath: Invalid check for mpp->wwid in dm_addmap()
Hannes Reinecke
hare at suse.de
Tue Jan 8 13:53:39 UTC 2013
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 at suse.de>
---
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
More information about the dm-devel
mailing list