[lkml]   [2011]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: ARM unaligned MMIO access with attribute((packed))
On Wed, Feb 02, 2011 at 05:51:27PM +0100, Richard Guenther wrote:
> > I would suggest fixing this by:
> >
> > 1. auditing all uses of __attribute__((packed)) in the Linux USB code
> > and other drivers, removing the ones that are potentially harmful.
> >
> > 2. Changing the ARM MMIO functions to use inline assembly instead of
> > direct pointer dereference.
> >
> > 3. Documenting the gcc behavior as undefined.
> The pointer conversions already invoke undefined behavior as specified by the
> C standard (

Just to be clear: you are not saying that the ARM implementation is

What you're saying is that converting from a pointer with less strict
alignment requirements to a pointer with more strict alignment
requirements is undefined.


unsigned long *blah(unsigned char *c)
return (unsigned long *)c;

would be undefined, but:

unsigned char *blah(unsigned long *c)
return (unsigned char *)c;

would not be.

If you're saying something else, please explain with reference to the
point in the C standard you quote above.

 \ /
  Last update: 2011-02-02 18:13    [W:0.102 / U:10.888 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site