
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@redhat.com> --- 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. Ah, correct me, this is a typing error.
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?
On 08/05/2011 12:18 AM, Eric Blake wrote: this is also a typing error.
Also, how does checking for a non-zero union value prevent a null dereference?
To be honest, I'm not sure this, however, it's okay for ccc-analyzer if I add these judgements, of course, I'm probably making a mistake, if so, please correct me. Thanks, Alex