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

Re: [Xen-devel] [PATCH 3/4] libxl: shutdown_reason cannot be unsigned

Hello Marcin,

On 13/09/14 14:10, Marcin Cieslak wrote:
Shutdown reason may be negative, so don't
cast it onto (unsigned int).

If you are looking the place where the variable is assigned, info[i].shutdown_reason is typed as an unsigned int.

So changing type doesn't look like the right solution. I've sent a few months ago a patch to drop "shutdown_reason >= 0" check [1].

It was acked, but I hadn't had time to resent this series properly. Mainly because I got other errors around with clang.


[1] https://patches.linaro.org/27074/

Clang complains:

xl_cmdimpl.c:3313:34: error: comparison of unsigned expression >= 0 is always 
true [-Werror,-Wtautological-compare]
                 (shutdown_reason >= 0 &&
                  ~~~~~~~~~~~~~~~ ^  ~
  tools/libxl/xl_cmdimpl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 86daf8e..f9ca22a 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3297,7 +3297,7 @@ static void list_domains(int verbose, int context, int 
claim, int numa,
      for (i = 0; i < nb_domain; i++) {
          char *domname;
-        unsigned shutdown_reason;
+        int shutdown_reason;
          domname = libxl_domid_to_name(ctx, info[i].domid);
          shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0;
          printf("%-40s %5d %5lu %5d     %c%c%c%c%c%c  %8.1f",

Julien Grall

Xen-devel mailing list



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