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

Re: [libvirt] [PATCH 07/12] qemu: reorder checks for safety



2011/6/6 Eric Blake <eblake redhat com>:
> 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.
> ---
>  src/qemu/qemu_cgroup.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index eba1e73..1298924 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -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;
> --
> 1.7.4.4

ACK.

Matthias


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