[libvirt] [PATCH 1/3] vbox: Avoid signed and unsigned comparison

Ján Tomko jtomko at redhat.com
Tue Feb 23 11:42:54 UTC 2016


On Tue, Feb 23, 2016 at 09:49:07AM +0100, Michal Privoznik wrote:
> After 457ff97fa there are two defects in our code. In both of
> them we use a signed variable to hold up a number of snapshots
> that domain has. We use a helper function to count the number.
> However, the helper function may fail in which case it returns
> a negative one and control jumps to cleanup label where an
> unsigned variable is used to iterate over array of snapshots. The
> loop condition thus compare signed and unsigned variables which
> in this specific case ends up badly for us.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/vbox/vbox_common.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 

ACK.

Does virStorageBackendRBDCleanupSnapshots need the same treatment?
I'm having trouble deciphering the code flow.

Jan




More information about the libvir-list mailing list