Re: [PATCH 4/5] test: drop redundant check

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

 



On 11/02/2011 12:42 PM, Stefan Berger wrote:
On 11/02/2011 02:00 PM, Eric Blake wrote:
libvirt.c guarantees that nparams is non-zero for scheduler parameters.

* src/test/test_driver.c (testDomainGetSchedulerParamsFlags): Drop
redundant check.
---
src/test/test_driver.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 4e1973a..de0f716 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2709,10 +2709,6 @@ testDomainGetSchedulerParamsFlags(virDomainPtr
domain,
goto cleanup;
}

- if (*nparams< 1) {
- testError(VIR_ERR_INVALID_ARG, "%s", _("Invalid parameter count"));
- goto cleanup;
- }
Following the note on the top of this mail, this seems not even to be
possible (and hopefully never will be).

My recent commit 5465bc0 included explicit documentation in libvirt.c that nparams can't be zero on virDomainGetSchedulerParams, fairly close to the actual code in that file that guarantees that condition before calling any driver callback.

strcpy(params[0].field, VIR_DOMAIN_SCHEDULER_WEIGHT);
Someone is still using strcpy!

At least this use was safe. But I went ahead and converted that to virStrcpyStatic.

params[0].type = VIR_TYPED_PARAM_UINT;
/* XXX */
ACK

I've gone ahead and pushed this series.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
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]