From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH 3/4] libxl: shutdown_reason cannot be unsigned Date: Tue, 16 Sep 2014 11:43:10 -0700 Message-ID: <541884BE.1020509@linaro.org> References: <1410642625-45876-1-git-send-email-saper@saper.info> <1410642625-45876-3-git-send-email-saper@saper.info> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XTxid-0003HA-LS for xen-devel@lists.xenproject.org; Tue, 16 Sep 2014 18:43:15 +0000 Received: by mail-pa0-f48.google.com with SMTP id hz1so347370pad.35 for ; Tue, 16 Sep 2014 11:43:12 -0700 (PDT) In-Reply-To: <1410642625-45876-3-git-send-email-saper@saper.info> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Marcin Cieslak , xen-devel@lists.xenproject.org, Ian Campbell , "xen.org" List-Id: xen-devel@lists.xenproject.org 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. Regards, [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, > printf("\n"); > 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