]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nodedev: handle failure to generate mdevctl cmd
authorJonathon Jongsma <jjongsma@redhat.com>
Tue, 20 Apr 2021 14:09:00 +0000 (09:09 -0500)
committerJonathon Jongsma <jjongsma@redhat.com>
Mon, 26 Apr 2021 17:24:22 +0000 (12:24 -0500)
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 <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/node_device/node_device_driver.c

index e565cc29ecb4de495e2ab380f8661586c15e9569..49f3cc166d8eb433015c10f4ca94337ab2fdd8a0 100644 (file)
@@ -743,7 +743,7 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
     case MDEVCTL_CMD_LAST:
     default:
         /* SHOULD NEVER HAPPEN */
-        break;
+        return NULL;
     }
 
     switch (cmd_type) {