From: Larry Finger <Larry.Finger@lwfinger.net>
To: Arnd Bergmann <arnd@kernel.org>, Kalle Valo <kvalo@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>,
linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] wifi: b43: fix incorrect __packed annotation
Date: Tue, 16 May 2023 12:53:03 -0500 [thread overview]
Message-ID: <b8e61f82-bb1d-4778-3624-157890b1b8dd@lwfinger.net> (raw)
In-Reply-To: <20230516074554.1674536-1-arnd@kernel.org>
On 5/16/23 02:45, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang warns about an unpacked structure inside of a packed one:
>
> drivers/net/wireless/broadcom/b43/b43.h:654:4: error: field data within 'struct b43_iv' is less aligned than 'union (unnamed union at /home/arnd/arm-soc/drivers/net/wireless/broadcom/b43/b43.h:651:2)' and is usually due to 'struct b43_iv' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
>
> The problem here is that the anonymous union has the default alignment
> from its members, apparently because the original author mixed up the
> placement of the __packed attribute by placing it next to the struct
> member rather than the union definition. As the struct itself is
> also marked as __packed, there is no need to mark its members, so just
> move the annotation to the inner type instead.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/wireless/broadcom/b43/b43.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/broadcom/b43/b43.h b/drivers/net/wireless/broadcom/b43/b43.h
> index 9fc7c088a539..67b4bac048e5 100644
> --- a/drivers/net/wireless/broadcom/b43/b43.h
> +++ b/drivers/net/wireless/broadcom/b43/b43.h
> @@ -651,7 +651,7 @@ struct b43_iv {
> union {
> __be16 d16;
> __be32 d32;
> - } data __packed;
> + } __packed data > } __packed;
This change works on a BCM4306 and BCM4318=.
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
To answer Michael's question, b43legacy has the same issue.
Larry
Larry
_______________________________________________
b43-dev mailing list
b43-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/b43-dev
prev parent reply other threads:[~2023-05-16 17:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 7:45 [PATCH] wifi: b43: fix incorrect __packed annotation Arnd Bergmann
2023-05-16 11:00 ` Simon Horman
2023-05-16 17:12 ` Michael Büsch
2023-05-16 17:45 ` Arnd Bergmann
2023-05-16 17:47 ` Michael Büsch
2023-05-16 17:53 ` Larry Finger [this message]
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=b8e61f82-bb1d-4778-3624-157890b1b8dd@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=b43-dev@lists.infradead.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=trix@redhat.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).