From: Michael Buesch <mb@bu3sch.de>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: John W Linville <linville@tuxdriver.com>,
chunkeey@web.de, linux-wireless@vger.kernel.org
Subject: Re: [RFC/RFT] p54: Fix sparse warnings
Date: Fri, 12 Sep 2008 20:39:21 +0200 [thread overview]
Message-ID: <200809122039.21179.mb@bu3sch.de> (raw)
In-Reply-To: <200809122036.03553.mb@bu3sch.de>
On Friday 12 September 2008 20:36:03 Michael Buesch wrote:
> On Friday 12 September 2008 20:16:03 Larry Finger wrote:
> > struct bootrec {
> > __le32 code;
> > __le32 len;
> > - u32 data[0];
> > + /* Most references to the data section that follows are for u32
> > + * quantities; however, one is for an le16 quantity. The union
> > + * below avoids a cast and makes the usage clearer. */
> > + union {
> > + u32 data[0];
> > + __le16 data16[0];
> > + };
> > } __attribute__((packed));
>
> I suggest you change
> u32 data[0];
> to
> __le32 data_le32[0];
> and also add
> __be32 data_be32[0];
> to the union. This avoids another few casts.
> (Maybe you don't even need the __le32 variant. I didn't check all the code).
Ah and I think you should also add packed attribute to the union
to tell the compiler to avoid any padding.
--
Greetings Michael.
next prev parent reply other threads:[~2008-09-12 18:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-12 18:16 [RFC/RFT] p54: Fix sparse warnings Larry Finger
2008-09-12 18:36 ` Michael Buesch
2008-09-12 18:39 ` Michael Buesch [this message]
2008-09-12 18:52 ` Larry Finger
2008-09-13 12:40 ` Michael Buesch
2008-09-13 15:40 ` Larry Finger
2008-09-17 16:15 ` Pavel Roskin
2008-09-17 17:16 ` Larry Finger
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=200809122039.21179.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=Larry.Finger@lwfinger.net \
--cc=chunkeey@web.de \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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.