All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Juergen Gross <jgross@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Olaf Hering <olaf@aepfle.de>,
	Paul Durrant <paul.durrant@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>
Subject: Re: bogus wrap check in xen-netback
Date: Wed, 25 Apr 2018 11:31:25 +0100	[thread overview]
Message-ID: <20180425103125.kllxadyujbqbiamq@citrix.com> (raw)
In-Reply-To: <5AE057BE02000078001BE50B@prv1-mh.provo.novell.com>

On Wed, Apr 25, 2018 at 04:26:06AM -0600, Jan Beulich wrote:
> >>> On 25.04.18 at 12:06, <wei.liu2@citrix.com> wrote:
> > On Wed, Apr 25, 2018 at 11:04:26AM +0200, Olaf Hering wrote:
> >> Am Wed, 25 Apr 2018 09:59:23 +0100
> >> schrieb Wei Liu <wei.liu2@citrix.com>:
> >> 
> >> > Do you have the full diff of your changes? 
> >> 
> >> Not right now. But without 'val', or val being uint, the same error happens 
> > in f():
> >> 
> >> #include <stdio.h>
> >> void f(void)
> >> {
> >>         unsigned short req_prod = 0, req_cons = 65400;
> >>         unsigned short val;
> >>         val = req_prod - req_cons;
> >>         printf("req_prod - req_cons %u\n", val);
> >>         printf("req_prod - req_cons %x\n", val);
> >> }
> > 
> > What Jan said.
> > 
> > Integer promotion makes unsigned short into unsigned int first then do
> > the calculation.
> 
> Not exactly - it promotes to plain (i.e. signed) int.

My bad. Yes, they are converted to int, not unsigned int.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-04-25 10:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25  7:19 bogus wrap check in xen-netback Olaf Hering
2018-04-25  7:28 ` Juergen Gross
2018-04-25  7:39   ` Olaf Hering
2018-04-25  8:59     ` Wei Liu
2018-04-25  9:04       ` Olaf Hering
2018-04-25  9:48         ` Jan Beulich
2018-04-25 10:06         ` Wei Liu
2018-04-25 10:26           ` Jan Beulich
2018-04-25 10:31             ` Wei Liu [this message]
2018-04-25 10:35               ` Olaf Hering
2018-04-25 10:47                 ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180425103125.kllxadyujbqbiamq@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=olaf@aepfle.de \
    --cc=paul.durrant@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.