From: Greg KH <gregkh@linuxfoundation.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Cyril Bur <cyrilbur@gmail.com>,
jk@ozlabs.org, andrew@aj.id.au, openbmc@lists.ozlabs.org,
joel@jms.id.au
Subject: Re: [PATCH v2] drivers/misc: Add ASpeed LPC control driver
Date: Mon, 16 Jan 2017 11:45:37 +0100 [thread overview]
Message-ID: <20170116104537.GA29148@kroah.com> (raw)
In-Reply-To: <1484541915.11927.31.camel@kernel.crashing.org>
On Sun, Jan 15, 2017 at 10:45:15PM -0600, Benjamin Herrenschmidt wrote:
> On Mon, 2017-01-16 at 09:43 +1100, Cyril Bur wrote:
> > > > +struct aspeed_lpc_ctrl_mapping {
> > > > + __u8 window_type;
> > > > + __u8 window_id;
> > > > + __u32 addr;
> > > > + __u32 offset;
> > > > + __u32 size;
> > >
> > > That's some crazy alignment, do you really mean to put a 32bit value
> > > aligned like that? Will it work properly on your systems?
> > >
> >
> > Well, in my probably unrealistic and rushed testing it did work - but
> > then this was all with one compiler on one machine so I'm not
> > surprised. I'll put the u8s at the end.
>
> This structure isn't packed, so the alignment is fine, the compiler
> will align "addr" to a 32-bit boundary. What might have been better
> would have be to be explicit about it by adding two u8 of padding
> (or a u16) but the above works. Moving things around just makes the
> structure more weird, the window and id make more sense being at the
> beginning.
For an ioctl structure like this, can you guarantee that the "padding"
will always be the same? Last time I looked, the C standard didn't say
anything about that, so I would strongly recommend making it so that no
padding is needed at all...
thanks,
greg k-h
next prev parent reply other threads:[~2017-01-16 10:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 7:47 [PATCH v2] drivers/misc: Add ASpeed LPC control driver Cyril Bur
2017-01-13 10:36 ` Greg KH
2017-01-15 22:43 ` Cyril Bur
2017-01-16 4:45 ` Benjamin Herrenschmidt
2017-01-16 10:45 ` Greg KH [this message]
2017-01-16 13:34 ` Benjamin Herrenschmidt
2017-01-18 22:47 ` Cyril Bur
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=20170116104537.GA29148@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=andrew@aj.id.au \
--cc=benh@kernel.crashing.org \
--cc=cyrilbur@gmail.com \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.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.