The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Mathieu Malaterre <malat@debian.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mac80211: Remove attribute packed from struct 'action'
Date: Thu, 24 Jan 2019 19:08:14 +0100	[thread overview]
Message-ID: <2b8b377a84883db1a45afb42204d8fb5a7d5ccf9.camel@sipsolutions.net> (raw)
In-Reply-To: <20190124180535.20216-1-malat@debian.org> (sfid-20190124_190610_293460_EB105BCB)

On Thu, 2019-01-24 at 19:05 +0100, Mathieu Malaterre wrote:
> During refactor in commit 9e478066eae4 ("mac80211: fix MU-MIMO
> follow-MAC mode") a new struct 'action' was declared with packed
> attribute as:
> 
>   struct {
>           struct ieee80211_hdr_3addr hdr;
>           u8 category;
>           u8 action_code;
>   } __packed action;
> 
> But since struct 'ieee80211_hdr_3addr' is declared with an aligned
> keyword as:
> 
>   struct ieee80211_hdr {
>   	__le16 frame_control;
>   	__le16 duration_id;
>   	u8 addr1[ETH_ALEN];
>   	u8 addr2[ETH_ALEN];
>   	u8 addr3[ETH_ALEN];
>   	__le16 seq_ctrl;
>   	u8 addr4[ETH_ALEN];
>   } __packed __aligned(2);
> 
> Solve the ambiguity of placing aligned structure in a packed one by
> removing the packed attribute from struct. This seems to be the behavior
> of gcc anyway, since the following is still compiling:
> 
>   BUILD_BUG_ON(sizeof(action) != IEEE80211_MIN_ACTION_SIZE + 1);

I'm not sure this will work on all platforms, didn't something like
alpha pad out u8's to u32 when not requiring packing?

I guess I'd feel better about using __packed __aligned(2) here as well,
which should solve the warning too?

johannes



  reply	other threads:[~2019-01-24 18:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 18:05 [PATCH] mac80211: Remove attribute packed from struct 'action' Mathieu Malaterre
2019-01-24 18:08 ` Johannes Berg [this message]
2019-01-24 18:14   ` Mathieu Malaterre
2019-01-24 18:19     ` Johannes Berg
2019-01-24 18:19 ` [PATCH v2] mac80211: Add attribute aligned(2) to " Mathieu Malaterre

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=2b8b377a84883db1a45afb42204d8fb5a7d5ccf9.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=malat@debian.org \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox