From 6b98a4b2e6ad55a95993b75c5829b0ce751b7240 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 2 Nov 2011 11:36:12 -0600 Subject: [PATCH] esx: allow getting < max typed parameters Allow the user to call with nparams too small, per API documentation. * src/esx/esx_driver.c (esxDomainGetMemoryParameters): Drop redundant check. (esxDomainGetSchedulerParametersFlags): Allow fewer than max. --- src/esx/esx_driver.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 7cff9c2103..92b56d8bb6 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -3635,12 +3635,6 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain, virCheckFlags(0, -1); - if (*nparams < 3) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Parameter array must have space for 3 items")); - return -1; - } - if (esxVI_EnsureSession(priv->primary) < 0) { return -1; } @@ -3656,7 +3650,7 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain, } for (dynamicProperty = virtualMachine->propSet; - dynamicProperty != NULL && mask != 7 && i < 3; + dynamicProperty != NULL && mask != 7 && i < 3 && i < *nparams; dynamicProperty = dynamicProperty->_next) { if (STREQ(dynamicProperty->name, "config.cpuAllocation.reservation") && ! (mask & (1 << 0))) { @@ -4886,12 +4880,6 @@ esxDomainGetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, return 0; } - if (*nparams < 1) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Parameter array must have space for 1 item")); - return -1; - } - if (esxVI_EnsureSession(priv->primary) < 0) { return -1; }