]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: Don't goto failure for invalid arguments in VMX code
authorMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 15 Dec 2009 22:49:56 +0000 (23:49 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 15 Dec 2009 22:49:56 +0000 (23:49 +0100)
This also fixes a NULL-deref of virtualDev in esxVMX_ParseSCSIController
found by Jim Meyering.

src/esx/esx_vmx.c

index f5b45440f4b115e8ed2676111e8853a2c2b67459..7967718bb2fcf2d52df56124918c10312e872bf9 100644 (file)
@@ -1165,14 +1165,14 @@ esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf, int controller,
 
     if (virtualDev == NULL || *virtualDev != NULL) {
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
-        goto failure;
+        return -1;
     }
 
     if (controller < 0 || controller > 3) {
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                   "SCSI controller index %d out of [0..3] range",
                   controller);
-        goto failure;
+        return -1;
     }
 
     snprintf(present_name, sizeof(present_name), "scsi%d.present", controller);
@@ -1642,7 +1642,7 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                   "Ethernet controller index %d out of [0..3] range",
                   controller);
-        goto failure;
+        return -1;
     }
 
     if (VIR_ALLOC(*def) < 0) {
@@ -1840,7 +1840,7 @@ esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     if (port < 0 || port > 3) {
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                   "Serial port index %d out of [0..3] range", port);
-        goto failure;
+        return -1;
     }
 
     if (VIR_ALLOC(*def) < 0) {
@@ -1964,7 +1964,7 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     if (port < 0 || port > 2) {
         ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
                   "Parallel port index %d out of [0..2] range", port);
-        goto failure;
+        return -1;
     }
 
     if (VIR_ALLOC(*def) < 0) {