Return-path: Received: from bu3sch.de ([62.75.166.246]:51582 "EHLO vs166246.vserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752106AbZFETDt (ORCPT ); Fri, 5 Jun 2009 15:03:49 -0400 From: Michael Buesch To: bcm43xx-dev@lists.berlios.de Subject: Re: [PATCH] b43: Fix possible unaligned u32 access Date: Fri, 5 Jun 2009 21:03:41 +0200 Cc: "John W. Linville" , linux-wireless@vger.kernel.org, Matthieu CASTET References: <200906042318.33895.mb@bu3sch.de> <200906051929.07714.mb@bu3sch.de> <20090605185047.GA7361@tuxdriver.com> In-Reply-To: <20090605185047.GA7361@tuxdriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Message-Id: <200906052103.41381.mb@bu3sch.de> Sender: linux-wireless-owner@vger.kernel.org List-ID: On Friday 05 June 2009 20:50:48 John W. Linville wrote: > On Fri, Jun 05, 2009 at 07:29:07PM +0200, Michael Buesch wrote: > > On Friday 05 June 2009 14:25:03 John W. Linville wrote: > > > On Thu, Jun 04, 2009 at 11:18:33PM +0200, Michael Buesch wrote: > > > > From: Matthieu CASTET > > > > > > > > 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 > > > > Signed-off-by: Michael Buesch > > > > > > That seems pretty brain-dead...can you cite a source for this > > > information? The patch seems like a no-op... > > > > > > John > > > > struct foo { > > int data; > > } __attribute__((packed)); > > > > struct foo foo; > > int *d = &foo->data; > > foo->data = x; /* Works for unaligned */ > > *d = y; /* Does not work for unaligned */ > > Why not? > Because some compilers don't carry the "packed" attribute of "data" though the "d" pointer. So foo->data is a "packed" access, while *d might not. -- Greetings, Michael.