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

Re: [Xen-devel] [PATCH for-4.7 5/7] tools/kdd: Fix uninitialised variable warning



On Wed, Apr 27, 2016 at 06:01:24PM +0100, Andrew Cooper wrote:
> Clang warns:
> 
>   kdd.c:1031:9: error: variable 'fd' is used uninitialized whenever '||'
>   condition is true [-Werror,-Wsometimes-uninitialized]
>       if (argc != 4
>           ^~~~~~~~~
>   kdd.c:1040:20: note: uninitialized use occurs here
>       if (select(fd + 1, &fds, NULL, NULL, NULL) > 0)
>                  ^~
> 
> This situation can't actually happen, as usage() is a terminal path.  Annotate
> it appropriately.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

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

> ---
> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
>  tools/debugger/kdd/kdd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
> index 9a0225b..70f007e 100644
> --- a/tools/debugger/kdd/kdd.c
> +++ b/tools/debugger/kdd/kdd.c
> @@ -998,7 +998,7 @@ void kdd_select_callback(kdd_state *s)
>  }
>  
>  
> -static void usage(void)
> +static void __attribute__((noreturn)) usage(void)
>  {
>      fprintf(stderr, 
>  " usage: kdd [-v] <domid> <address> <port>\n"
> -- 
> 2.1.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.