Re: [PATCH 1/3] qemu: Add missing goto error in qemuRestoreCgroupState

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

 



On 12/16/2014 12:13 PM, Martin Kletzander wrote:
> Commit af2a1f05 tried clearly separating each condition in
> qemuRestoreCgroupState() for the sake of readability, however somehow
> one condition body was missing.  That means that the body of the next
> condition got executed only if both of there were true, which is
> impossible, thus resulting in a dead code and a logic error.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_cgroup.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 1e383c4..164ad05 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -801,6 +801,7 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
> 
>      if ((empty = virCgroupHasEmptyTasks(priv->cgroup,
>                                          VIR_CGROUP_CONTROLLER_CPUSET)) < 0)
> +        goto error;
> 
>      if (!empty)
>          goto error;

Why not the shorter:

if ((empty - virCgroupHasEmptyTasks(priv->cgroup,
                                    VIR_CGROUP_CONTROLLER_CPUSET)) <= 0)
    goto error;

ACK to either style of fix.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]