From 576b2c7514330921fc60e0352db8da2372f2d3be Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Tue, 15 Dec 2009 23:49:56 +0100 Subject: [PATCH] esx: Don't goto failure for invalid arguments in VMX code This also fixes a NULL-deref of virtualDev in esxVMX_ParseSCSIController found by Jim Meyering. --- src/esx/esx_vmx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c index f5b45440f4..7967718bb2 100644 --- a/src/esx/esx_vmx.c +++ b/src/esx/esx_vmx.c @@ -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) {