From: David Miller <davem@davemloft.net>
To: David.Laight@ACULAB.COM
Cc: amwang@redhat.com, netdev@vger.kernel.org,
bhutchings@solarflare.com, horms@verge.net.au
Subject: Re: [Patch net-next v3] net: clean up skb headers code
Date: Thu, 30 May 2013 13:16:03 -0700 (PDT) [thread overview]
Message-ID: <20130530.131603.1155012584617016387.davem@davemloft.net> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7258@saturn3.aculab.com>
From: "David Laight" <David.Laight@ACULAB.COM>
Date: Thu, 30 May 2013 12:18:13 +0100
>> commit 1a37e412a0225fcba5587 (net: Use 16bits for *_headers
>> fields of struct skbuff) converts skb->*_header to u16,
>> some #if NET_SKBUFF_DATA_USES_OFFSET are now useless,
>> and to be safe, we could just use "X = ~(typeof(X))0;"
>> as suggested by David and Ben.
>
> IIRC ~(unsigned short)0 is the same as ~0 and will be -1.
> define an actual constant with value 0xffff
The problem with doing that is that if this type is changed again,
we'lll go through this same circus changing the constant everywhere
and missing some cases.
I absolutely want to see a version of this fix that makes sure that if
the type changes, either the constantly automatically change (that's
the "typeof(X)" approach) or the build breaks spectacularly until the
value is fixed up.
next prev parent reply other threads:[~2013-05-30 20:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 2:06 [Patch net-next v3] net: clean up skb headers code Cong Wang
2013-05-30 11:18 ` David Laight
2013-05-30 20:16 ` David Miller [this message]
2013-05-30 21:05 ` Ben Hutchings
2013-05-31 0:18 ` Simon Horman
2013-05-31 0:25 ` Simon Horman
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=20130530.131603.1155012584617016387.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=David.Laight@ACULAB.COM \
--cc=amwang@redhat.com \
--cc=bhutchings@solarflare.com \
--cc=horms@verge.net.au \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox