public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici•org>
To: David Laight <David.Laight@ACULAB•COM>
Cc: Ben Hutchings <bhutchings@solarflare•com>,
	David Miller <davem@davemloft•net>,
	amwang@redhat•com, netdev@vger•kernel.org, horms@verge•net.au
Subject: Re: [Patch net-next] net: clean up skb headers code
Date: Thu, 30 May 2013 14:24:59 +0200	[thread overview]
Message-ID: <20130530122459.GE2475@ritirata.org> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B725B@saturn3.aculab.com>

[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]

On Thu, May 30, 2013 at 01:22:14PM +0100, David Laight wrote:
> > Of course - we need to look at the value that ALL_ONES()
> > generates in an expression. So the test print needs to be:
> > 	printf("%hhx %hhx %hx %hx %x %x %lx %lx %llx %llx\n",
> > 		ALL_ONES(a), ALL_ONES(b), ALL_ONES(c), ALL_ONES(d),
> > 		ALL_ONES(e), ALL_ONES(f), ALL_ONES(g), ALL_ONES(h),
> > 		ALL_ONES(i), ALL_ONES(j));
> > which then gives 0xffffffff for the first 4 entries.
> 
> Except I copied the wrong format line :-( It should be:
>  	printf("%x %x %x %x %x %x %lx %lx %llx %llx\n",
>  		ALL_ONES(a), ALL_ONES(b), ALL_ONES(c), ALL_ONES(d),
>  		ALL_ONES(e), ALL_ONES(f), ALL_ONES(g), ALL_ONES(h),
>  		ALL_ONES(i), ALL_ONES(j));

Oh ok, I see the issue now.

So the problem is that this value gets bigger than what the maximal
value for the type passed as argument is supposed to be.

I think the issue is clear now and why a double cast is good.

Cheers,


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-05-30 12:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29  6:09 [Patch net-next] net: clean up skb headers code Cong Wang
2013-05-29  6:36 ` David Miller
2013-05-29  6:48   ` Cong Wang
2013-05-29  6:49     ` David Miller
2013-05-29 19:34   ` Ben Hutchings
2013-05-29 19:44     ` Antonio Quartulli
2013-05-29 21:02       ` Ben Hutchings
2013-05-30  8:59         ` Antonio Quartulli
2013-05-30 11:41         ` David Laight
2013-05-30 11:45           ` Antonio Quartulli
2013-05-30 12:12             ` David Laight
2013-05-30 12:22               ` David Laight
2013-05-30 12:24                 ` Antonio Quartulli [this message]
2013-05-30 12:40                   ` David Laight
2013-05-30 12:23               ` Antonio Quartulli
2013-05-30  1:59     ` Cong Wang
2013-05-30 12:30       ` Sergei Shtylyov
2013-05-30 10:40     ` David Miller
2013-05-30 14:11       ` Ben Hutchings

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=20130530122459.GE2475@ritirata.org \
    --to=ordex@autistici$(echo .)org \
    --cc=David.Laight@ACULAB$(echo .)COM \
    --cc=amwang@redhat$(echo .)com \
    --cc=bhutchings@solarflare$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=horms@verge$(echo .)net.au \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox