diff mbox

ieee80211_i.h: Align struct ps_data.tim to unsigned long

Message ID 1387414337.13593.48.camel@joe-AO722
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Joe Perches Dec. 19, 2013, 12:52 a.m. UTC
Its address is used as an unsigned long *, so make sure
that the tim u8 array is properly aligned.

Signed-off-by: Joe Perches <joe@perches.com
---
> Care to send a proper patch? Otherwise I'll just re-do it and pick it up
> that way ...

I had a passing thought about this when out today.
It should really be set to __aligned(__alignof(unsigned long))
so here's a proper patch.

 net/mac80211/ieee80211_i.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Johannes Berg Dec. 19, 2013, 8:19 a.m. UTC | #1
On Wed, 2013-12-18 at 16:52 -0800, Joe Perches wrote:
> Its address is used as an unsigned long *, so make sure
> that the tim u8 array is properly aligned.
> 
> Signed-off-by: Joe Perches <joe@perches.com
> ---
> > Care to send a proper patch? Otherwise I'll just re-do it and pick it up
> > that way ...
> 
> I had a passing thought about this when out today.
> It should really be set to __aligned(__alignof(unsigned long))
> so here's a proper patch.

Hmm, yeah, I guess that's true, though sizeof() is probably >= on
anything where Linux runs (and otherwise arrays get problematic anyway?)

Anyway, I've dropped my patch in favour of yours.

johannes

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ed5bf8b..9a61eef 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -245,7 +245,8 @@  struct ps_data {
 	/* yes, this looks ugly, but guarantees that we can later use
 	 * bitmap_empty :)
 	 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
-	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
+	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]
+			__aligned(__alignof__(unsigned long));
 	struct sk_buff_head bc_buf;
 	atomic_t num_sta_ps; /* number of stations in PS mode */
 	int dtim_count;