Re: [PATCH 1/5] esx: allow getting < max typed parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/02/2011 02:00 PM, Eric Blake wrote:
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 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 7cff9c2..92b56d8 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;
      }
ACK

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]