1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

coverity: fix compiler warning

LVM2.2.02.112/lib/activate/dev_manager.c:196:5: warning: 'dmtask' may be used uninitialized in this function [-Wmaybe-uninitialized]

In _info_run fn:

switch (type) {
	case INFO:
		...
	case STATUS:
		...
	case MKNODES:
		...
}

The "type" is enum and currently only those three types are supported,
but if we added a new type in the future, this would end up with a bug
(if we forgot to add the new "case" in that "switch"). So let's make
sure proper internal error is printed:

	default:
		log_error(INTERNAL_ERROR "_info_run: unhandled info type");
                return 0;
This commit is contained in:
Peter Rajnoha 2014-11-12 09:42:53 +01:00
parent 57c618b0ed
commit 60cc666c94

View File

@ -191,6 +191,9 @@ static int _info_run(info_type_t type, const char *name, const char *dlid,
case MKNODES: case MKNODES:
dmtask = DM_DEVICE_MKNODES; dmtask = DM_DEVICE_MKNODES;
break; break;
default:
log_error(INTERNAL_ERROR "_info_run: unhandled info type");
return 0;
} }
if (!(dmt = _setup_task(type != MKNODES ? name : NULL, dlid, 0, dmtask, if (!(dmt = _setup_task(type != MKNODES ? name : NULL, dlid, 0, dmtask,