Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCHv2 ath-next] wifi: ath9k: mark static arrays as const
@ 2026-06-19 17:52 Rosen Penev
  2026-06-22 11:49 ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 4+ messages in thread
From: Rosen Penev @ 2026-06-19 17:52 UTC (permalink / raw)
  To: linux-wireless; +Cc: Toke Høiland-Jørgensen, open list

PN9Data is a read-only lookup table and is never modified.  Adding const
lets the compiler place it in .rodata and prevents accidental writes.

Use the same treatment for bits_per_symbol. It's not modified either.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v2: mention bits_per_symbol.
 drivers/net/wireless/ath/ath9k/tx99.c | 16 ++++++++--------
 drivers/net/wireless/ath/ath9k/xmit.c |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/tx99.c b/drivers/net/wireless/ath/ath9k/tx99.c
index f2144fd39093..b52d84f6cbc9 100644
--- a/drivers/net/wireless/ath/ath9k/tx99.c
+++ b/drivers/net/wireless/ath/ath9k/tx99.c
@@ -39,14 +39,14 @@ static void ath9k_tx99_stop(struct ath_softc *sc)

 static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc)
 {
-	static u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
-			       0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
-			       0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
-			       0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
-			       0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
-			       0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
-			       0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
-			       0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
+	static const u8 PN9Data[] = {0xff, 0x87, 0xb8, 0x59, 0xb7, 0xa1, 0xcc, 0x24,
+			             0x57, 0x5e, 0x4b, 0x9c, 0x0e, 0xe9, 0xea, 0x50,
+			             0x2a, 0xbe, 0xb4, 0x1b, 0xb6, 0xb0, 0x5d, 0xf1,
+			             0xe6, 0x9a, 0xe3, 0x45, 0xfd, 0x2c, 0x53, 0x18,
+			             0x0c, 0xca, 0xc9, 0xfb, 0x49, 0x37, 0xe5, 0xa8,
+			             0x51, 0x3b, 0x2f, 0x61, 0xaa, 0x72, 0x18, 0x84,
+			             0x02, 0x23, 0x23, 0xab, 0x63, 0x89, 0x51, 0xb3,
+			             0xe7, 0x8b, 0x72, 0x90, 0x4c, 0xe8, 0xfb, 0xc0};
 	u32 len = 1200;
 	struct ieee80211_tx_rate *rate;
 	struct ieee80211_hw *hw = sc->hw;
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 89d8b3178784..57e451548958 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -41,7 +41,7 @@
 #define ATH9K_PWRTBL_11NG_HT_SHIFT      12


-static u16 bits_per_symbol[][2] = {
+static const u16 bits_per_symbol[][2] = {
 	/* 20MHz 40MHz */
 	{    26,   54 },     /*  0: BPSK */
 	{    52,  108 },     /*  1: QPSK 1/2 */
--
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 ath-next] wifi: ath9k: mark static arrays as const
  2026-06-19 17:52 [PATCHv2 ath-next] wifi: ath9k: mark static arrays as const Rosen Penev
@ 2026-06-22 11:49 ` Toke Høiland-Jørgensen
  2026-06-22 21:11   ` Rosen Penev
  0 siblings, 1 reply; 4+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-06-22 11:49 UTC (permalink / raw)
  To: Rosen Penev, linux-wireless; +Cc: open list

Rosen Penev <rosenp@gmail.com> writes:

> PN9Data is a read-only lookup table and is never modified.  Adding const
> lets the compiler place it in .rodata and prevents accidental writes.
>
> Use the same treatment for bits_per_symbol. It's not modified either.
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Again, which actual bug are you fixing here?

-Toke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 ath-next] wifi: ath9k: mark static arrays as const
  2026-06-22 11:49 ` Toke Høiland-Jørgensen
@ 2026-06-22 21:11   ` Rosen Penev
  2026-06-23 12:58     ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 4+ messages in thread
From: Rosen Penev @ 2026-06-22 21:11 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: linux-wireless, open list

On Mon, Jun 22, 2026 at 4:49 AM Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>
> Rosen Penev <rosenp@gmail.com> writes:
>
> > PN9Data is a read-only lookup table and is never modified.  Adding const
> > lets the compiler place it in .rodata and prevents accidental writes.
> >
> > Use the same treatment for bits_per_symbol. It's not modified either.
> >
> > Assisted-by: opencode:big-pickle
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
>
> Again, which actual bug are you fixing here?
Patches are required to be bugfixes?
>
> -Toke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 ath-next] wifi: ath9k: mark static arrays as const
  2026-06-22 21:11   ` Rosen Penev
@ 2026-06-23 12:58     ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 4+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-06-23 12:58 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-wireless, open list

Rosen Penev <rosenp@gmail.com> writes:

> On Mon, Jun 22, 2026 at 4:49 AM Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>>
>> Rosen Penev <rosenp@gmail.com> writes:
>>
>> > PN9Data is a read-only lookup table and is never modified.  Adding const
>> > lets the compiler place it in .rodata and prevents accidental writes.
>> >
>> > Use the same treatment for bits_per_symbol. It's not modified either.
>> >
>> > Assisted-by: opencode:big-pickle
>> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>
>> Again, which actual bug are you fixing here?
> Patches are required to be bugfixes?

Well, or at least have some concrete benefit? You're changing working
code here, we've had to revert patches of this kind before because it
broke things.

For this patch specifically, there's one of two cases:

- The array is never written to, in which case the patch has no
  practical effect

or

- The array *is* actually written to somewhere, in which case the kernel
  will now crash as soon as someone tries to run the code.

Either way, I don't see how the risk/benefit tradeoff comes off positive
for this patch?

-Toke

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-23 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-19 17:52 [PATCHv2 ath-next] wifi: ath9k: mark static arrays as const Rosen Penev
2026-06-22 11:49 ` Toke Høiland-Jørgensen
2026-06-22 21:11   ` Rosen Penev
2026-06-23 12:58     ` 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