提交 4eb17d64 编写于 作者: E Eric Blake

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.
上级 208a6756
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册