mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
qemudDomainAttachSCSIDisk: handle empty controller list
* src/qemu/qemu_driver.c (qemudDomainAttachSCSIDisk): Handle the (theoretical) case of an empty controller list, so that clang does not think the subsequent dereference of "cont" would dereference an undefined variable (due to preceding loop not iterating even once).
This commit is contained in:
parent
1a4d5c9543
commit
f5a6ce44ce
@ -6090,6 +6090,12 @@ static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,
|
||||
if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
|
||||
goto error;
|
||||
|
||||
if (disk->info.addr.drive.controller <= 0) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("no drive controller for %s"), disk->dst);
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
|
||||
cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i, qemuCmdFlags);
|
||||
if (!cont)
|
||||
|
Loading…
Reference in New Issue
Block a user