tools/kdd: Fix uninitialised variable warning
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 27 Apr 2016 12:58:27 +0000 (13:58 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 27 Apr 2016 19:31:48 +0000 (20:31 +0100)
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@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
tools/debugger/kdd/kdd.c

index 9a0225b807410c05011a2a20bccd86405163504c..70f007eb175ae919d78e84dabe4a9fc94116150c 100644 (file)
@@ -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"