mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-08 14:29:56 +00:00
qemu: reorder checks for safety
Detected by Coverity. All existing callers happen to be in range, so this isn't too serious. * src/qemu/qemu_cgroup.c (qemuCgroupControllerActive): Check bounds before dereference.
This commit is contained in:
parent
208a675688
commit
4eb17d642e
@ -48,10 +48,10 @@ bool qemuCgroupControllerActive(struct qemud_driver *driver,
|
||||
{
|
||||
if (driver->cgroup == NULL)
|
||||
return false;
|
||||
if (!virCgroupMounted(driver->cgroup, controller))
|
||||
return false;
|
||||
if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST)
|
||||
return false;
|
||||
if (!virCgroupMounted(driver->cgroup, controller))
|
||||
return false;
|
||||
if (driver->cgroupControllers & (1 << controller))
|
||||
return true;
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user