diff mbox series

ath9k: use struct_group() to silence static checker warning

Message ID 6de44cd9-a9a0-4b76-a9b5-a3c37b97f9aa@moroto.mountain (mailing list archive)
State Handled Elsewhere
Delegated to: Toke Høiland-Jørgensen
Headers show
Series ath9k: use struct_group() to silence static checker warning | expand

Commit Message

Dan Carpenter July 3, 2023, 2:17 p.m. UTC
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(-)

Comments

Arnd Bergmann July 3, 2023, 2:54 p.m. UTC | #1
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>
Toke Høiland-Jørgensen July 3, 2023, 5:35 p.m. UTC | #2
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
diff mbox series

Patch

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