Re: [libvirt] [PATCH] esx_vi: remove unreachable code

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

 



2009/9/3 Jim Meyering <jim@xxxxxxxxxxxx>:
> This removes dead code and suppresses a warning from clang.
> However, see below:
>
> >From 2ed548cbe948aa7ef37ccd121bd084bd05019ac8 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@xxxxxxxxxx>
> Date: Thu, 3 Sep 2009 16:35:47 +0200
> Subject: [PATCH] esx_vi: remove unreachable code
>
> * src/esx/esx_vi.c (esxVI_Enumeration_Deserialize): Remove
> unreachable code.
> ---
>  src/esx/esx_vi.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
> index 0da908b..c689a7a 100644
> --- a/src/esx/esx_vi.c
> +++ b/src/esx/esx_vi.c
> @@ -857,8 +857,6 @@ esxVI_Enumeration_Deserialize(virConnectPtr conn,
>
>   failure:
>     goto cleanup;
> -
> -    result = -1;
>  }
>
> --------------------------------------------
>
> This function does not allow the caller to distinguish
> via its return value whether it has failed.
> It always returns 0.
>
> I see that this function's return value is used in numerous places
> (each esxVI_.*Deserialize function), so this should be fixed.
>

Oops, however that happened... good find. The clang analyzer seems to
be a valuable tool.

The fix for this is to swap "goto cleanup;" and "result = -1;" (see
attached patch).

Matthias

Attachment: esx_fix_failure_case_of_esxVI_Enumeration_Deserialize.patch
Description: application/mbox

--
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]