Search Linux Wireless

Re: [PATCH] b43: Fix possible unaligned u32 access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "John W. Linville" <linville@xxxxxxxxxxxxx>
Date: Fri, 5 Jun 2009 08:25:03 -0400

> On Thu, Jun 04, 2009 at 11:18:33PM +0200, Michael Buesch wrote:
>> From: Matthieu CASTET <castet.matthieu@xxxxxxx>
>> 
>> Fix possible unaligned u32 access in b43_generate_plcp_hdr().
>> Unaligned data is read/write with a u32 pointer instead of using the
>> packed structure. Some versions of gcc ignore the "packed" attribute, if the
>> structure element is accessed through a local pointer.
>> 
>> Signed-off-by: Matthieu CASTET <castet.matthieu@xxxxxxx>
>> Signed-off-by: Michael Buesch <mb@xxxxxxxxx>
> 
> That seems pretty brain-dead...can you cite a source for this
> information?  The patch seems like a no-op...

The "packed" attribute simply doesn't propagate.  It isn't
a GCC bug.  Look at this:

struct foo {
	u32 x;
} attribute((packed));

u32 bar(struct foo *p)
{
	u32 *p = &p->x;

	return *p;
}

That will (correctly) do a 32-bit aligned load, only doing
the "return p->x;" will proply respect the packed attribute.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux