diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 607a3478a3..d13bae33f2 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -799,6 +799,10 @@ virMdevctlCreate(virNodeDeviceDef *def, char **uuid, char **errmsg) MDEVCTL_CMD_CREATE, uuid, errmsg); + + if (!cmd) + return -1; + /* an auto-generated uuid is returned via stdout if no uuid is specified in * the mdevctl args */ if (virCommandRun(cmd, &status) < 0 || status != 0) @@ -819,6 +823,9 @@ virMdevctlDefine(virNodeDeviceDef *def, char **uuid, char **errmsg) MDEVCTL_CMD_DEFINE, uuid, errmsg); + if (!cmd) + return -1; + /* an auto-generated uuid is returned via stdout if no uuid is specified in * the mdevctl args */ if (virCommandRun(cmd, &status) < 0 || status != 0) @@ -925,6 +932,9 @@ virMdevctlStop(virNodeDeviceDef *def, char **errmsg) cmd = nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_STOP, NULL, errmsg); + if (!cmd) + return -1; + if (virCommandRun(cmd, &status) < 0 || status != 0) return -1; @@ -940,6 +950,9 @@ virMdevctlUndefine(virNodeDeviceDef *def, char **errmsg) cmd = nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_UNDEFINE, NULL, errmsg); + if (!cmd) + return -1; + if (virCommandRun(cmd, &status) < 0 || status != 0) return -1; @@ -955,6 +968,9 @@ virMdevctlStart(virNodeDeviceDef *def, char **errmsg) cmd = nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_START, NULL, errmsg); + if (!cmd) + return -1; + if (virCommandRun(cmd, &status) < 0 || status != 0) return -1;