From: Jonathon Jongsma Date: Tue, 20 Apr 2021 14:09:00 +0000 (-0500) Subject: nodedev: handle failure to generate mdevctl cmd X-Git-Tag: v7.3.0-rc1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d847765d289115d65c15203922f52a33de6c0be;p=thirdparty%2Flibvirt.git nodedev: handle failure to generate mdevctl cmd Coverity complained that the 'default' case of the switch in nodeDeviceGetMdevctlCommand() was falling through without initializing 'cmd'. Return NULL in this case even though it should never happen. Signed-off-by: Jonathon Jongsma Reviewed-by: Michal Privoznik --- diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index e565cc29ec..49f3cc166d 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -743,7 +743,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def, case MDEVCTL_CMD_LAST: default: /* SHOULD NEVER HAPPEN */ - break; + return NULL; } switch (cmd_type) {