* [PATCH] ath9k: use struct_group() to silence static checker warning
@ 2023-07-03 14:17 Dan Carpenter
2023-07-03 14:54 ` Arnd Bergmann
2023-07-03 17:35 ` Toke Høiland-Jørgensen
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-07-03 14:17 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: Kalle Valo, linux-wireless, kernel-janitors, Arnd Bergmann
We are deliberately copying both ba_high and ba_low so use a struct
group to make that clear. Otherwise static checkers like Smatch and
Clang complain that we are copying beyond the end of the ba_low struct
member.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/net/wireless/ath/ath9k/mac.h | 6 ++++--
drivers/net/wireless/ath/ath9k/xmit.c | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
index af44b33814dd..f03d792732da 100644
--- a/drivers/net/wireless/ath/ath9k/mac.h
+++ b/drivers/net/wireless/ath/ath9k/mac.h
@@ -115,8 +115,10 @@ struct ath_tx_status {
u8 qid;
u16 desc_id;
u8 tid;
- u32 ba_low;
- u32 ba_high;
+ struct_group(ba,
+ u32 ba_low;
+ u32 ba_high;
+ );
u32 evm0;
u32 evm1;
u32 evm2;
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index f6f2ab7a63ff..42058368e637 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -468,7 +468,7 @@ static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
isaggr = bf_isaggr(bf);
if (isaggr) {
seq_st = ts->ts_seqnum;
- memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3);
+ memcpy(ba, &ts->ba, WME_BA_BMP_SIZE >> 3);
}
while (bf) {
@@ -551,7 +551,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
if (isaggr && txok) {
if (ts->ts_flags & ATH9K_TX_BA) {
seq_st = ts->ts_seqnum;
- memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3);
+ memcpy(ba, &ts->ba, WME_BA_BMP_SIZE >> 3);
} else {
/*
* AR5416 can become deaf/mute when BA
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ath9k: use struct_group() to silence static checker warning
2023-07-03 14:17 [PATCH] ath9k: use struct_group() to silence static checker warning Dan Carpenter
@ 2023-07-03 14:54 ` Arnd Bergmann
2023-07-03 17:35 ` Toke Høiland-Jørgensen
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2023-07-03 14:54 UTC (permalink / raw)
To: Dan Carpenter, Toke Høiland-Jørgensen
Cc: Kalle Valo, linux-wireless, kernel-janitors
On Mon, Jul 3, 2023, at 16:17, Dan Carpenter wrote:
> We are deliberately copying both ba_high and ba_low so use a struct
> group to make that clear. Otherwise static checkers like Smatch and
> Clang complain that we are copying beyond the end of the ba_low struct
> member.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ath9k: use struct_group() to silence static checker warning
2023-07-03 14:17 [PATCH] ath9k: use struct_group() to silence static checker warning Dan Carpenter
2023-07-03 14:54 ` Arnd Bergmann
@ 2023-07-03 17:35 ` Toke Høiland-Jørgensen
1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-07-03 17:35 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Kalle Valo, linux-wireless, kernel-janitors, Arnd Bergmann
Dan Carpenter <dan.carpenter@linaro.org> writes:
> We are deliberately copying both ba_high and ba_low so use a struct
> group to make that clear. Otherwise static checkers like Smatch and
> Clang complain that we are copying beyond the end of the ba_low struct
> member.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Thanks for the fix; however, an identical patch is already queued, here:
https://patchwork.kernel.org/project/linux-wireless/patch/20230620080855.396851-2-dmantipov@yandex.ru/
-Toke
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-03 17:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03 14:17 [PATCH] ath9k: use struct_group() to silence static checker warning Dan Carpenter
2023-07-03 14:54 ` Arnd Bergmann
2023-07-03 17:35 ` Toke Høiland-Jørgensen
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 NNTP newsgroup(s).