On 08/04/2011 09:51 AM, Alex Jia wrote:
* src/qemu/qemu_driver.c: avoid dereference of null pointer.
Signed-off-by: Alex Jia<ajia@xxxxxxxxxx>
---
src/qemu/qemu_driver.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ce19be7..28ffff7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5697,7 +5697,8 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
continue;
}
- persistentDef->blkio.weight = params[i].value.ui;
+ if (params[i].value.ul)
+ persistentDef->blkio.weight = params[i].value.ui;
Why check ul, but then use ui? That seems broken.
if (flags& VIR_DOMAIN_AFFECT_CONFIG) {
- vmdef->cputune.quota = params[i].value.l;
+ if (params[i].value.ul)
+ vmdef->cputune.quota = params[i].value.l;
Why check ul, but then use l?
Also, how does checking for a non-zero union value prevent a null
dereference?
--
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