On 04/14/2010 10:02 AM, Jim Meyering wrote:
From: Jim Meyering <meyering(a)redhat.com>
* 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(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org