diff mbox

[1/2] libxl: ensure var is inited in libxl__domain_firmware

Message ID 1457403820-2949-1-git-send-email-cardoe@cardoe.com (mailing list archive)
State New, archived
Headers show

Commit Message

Douglas Goldstein March 8, 2016, 2:23 a.m. UTC
Some versions of GCC complain that the 'firmware' variable can be used
uninitialized. It looks like the switch inside of the else case is just
confusing GCC.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_dom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Liu March 8, 2016, 3:38 p.m. UTC | #1
On Mon, Mar 07, 2016 at 08:23:39PM -0600, Doug Goldstein wrote:
> Some versions of GCC complain that the 'firmware' variable can be used
> uninitialized. It looks like the switch inside of the else case is just
> confusing GCC.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/libxl/libxl_dom.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index 664adad..b825b98 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -867,7 +867,7 @@ static int libxl__domain_firmware(libxl__gc *gc,
>                                    struct xc_dom_image *dom)
>  {
>      libxl_ctx *ctx = libxl__gc_owner(gc);
> -    const char *firmware;
> +    const char *firmware = NULL;
>      int e, rc;
>      int datalen = 0;
>      void *data;
> -- 
> 2.4.10
>
Douglas Goldstein March 10, 2016, 3:13 p.m. UTC | #2
On 3/8/16 9:38 AM, Wei Liu wrote:
> On Mon, Mar 07, 2016 at 08:23:39PM -0600, Doug Goldstein wrote:
>> Some versions of GCC complain that the 'firmware' variable can be used
>> uninitialized. It looks like the switch inside of the else case is just
>> confusing GCC.
>>
>> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 

I sent these two together but they really aren't dependent on each other
so this can go in without the other.
diff mbox

Patch

diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 664adad..b825b98 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -867,7 +867,7 @@  static int libxl__domain_firmware(libxl__gc *gc,
                                   struct xc_dom_image *dom)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    const char *firmware;
+    const char *firmware = NULL;
     int e, rc;
     int datalen = 0;
     void *data;