Re: [libvirt] [PATCH 5/7] qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang

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

 



On 04/14/2010 10:02 AM, Jim Meyering wrote:
> From: Jim Meyering <meyering@xxxxxxxxxx>
> 
> * src/qemu/qemu_driver.c (qemudDomainAttachSCSIDisk):
> Initialize "cont" to NULL, so clang knows it's set.
> Add an sa_assert so it knows it's non-NULL when dereferenced.
> ---
> @@ -6894,6 +6894,11 @@ static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,

A bit more context would have made review a tad easier:

int i;
...
    for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
        cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i,
qemuCmdFl
ags);
        if (!cont)
>              goto error;
>      }
> 
> +    /* Tell clang that "cont" is non-NULL.
> +       This is because disk->info.addr.driver.controller is unsigned,
> +       and hence the above loop must iterate at least once.  */
> +    sa_assert (cont);

At any rate, ACK, once 1/7 is approved.

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

Attachment: signature.asc
Description: OpenPGP digital signature

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