Skip to contentSkip to conversation

wifi: ath12k: sanitize ath12k_mac_allocate() return code

PATCH In review Arnd Bergmann 3 participants 6 messages Feb 13, 2024 – Feb 14, 2024 Qualcomm ATH12K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath12k: sanitize ath12k_mac_allocate() return code

From: Arnd Bergmann <[email protected]>

The return code has no initializer:

drivers/net/wireless/ath/ath12k/mac.c:8006:9: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

Make it return -ENOMEM for allocation failures and remove the unused variable instead.

Fixes 6db6e70a17f6 ("wifi: ath12k: Introduce the container for mac80211 hw")
---
 drivers/net/wireless/ath/ath12k/mac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +2 -2
index f2f7b2a60261..e93475ae8d07 100644
@@ -7965,7 +7965,7 @@ int ath12k_mac_allocate(struct ath12k_base *ab)
 {
 	struct ath12k_hw *ah;
 	struct ath12k_pdev_map pdev_map[MAX_RADIOS];
-	int ret, i, j;
+	int i, j;
 	u8 radio_per_hw;
 
 	if (test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags))
@@ -8003,5 +8003,5 @@ int ath12k_mac_allocate(struct ath12k_base *ab)
 		ab->ah[i] = NULL;
 	}
 
-	return ret;
+	return -ENOMEM;
 }
Signature · 1 line
2.39.2
#1 lore raw
Quoted 10 lines · Arnd Bergmann

The return code has no initializer:

drivers/net/wireless/ath/ath12k/mac.c:8006:9: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

Make it return -ENOMEM for allocation failures and remove the unused variable instead.

Fixes 6db6e70a17f6 ("wifi: ath12k: Introduce the container for mac80211 hw")

Nathan already fixed this:

https://git.kernel.org/kvalo/ath/c/04edb5dc68f4

Patch set to Rejected.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
Quoted 13 lines · Kalle Valo
Quoted 10 lines · Arnd Bergmann

The return code has no initializer:

drivers/net/wireless/ath/ath12k/mac.c:8006:9: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

Make it return -ENOMEM for allocation failures and remove the unused variable instead.

Fixes 6db6e70a17f6 ("wifi: ath12k: Introduce the container for mac80211 hw")
Quoted 5 lines

Nathan already fixed this:

https://git.kernel.org/kvalo/ath/c/04edb5dc68f4

Patch set to Rejected.

Ok, sounds good. Nathan's patch looks fine to me, but I see it's not in linux-next yet as of today.

Arnd

#3 lore raw
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Kalle Valo
Quoted 10 lines · Arnd Bergmann

The return code has no initializer:

drivers/net/wireless/ath/ath12k/mac.c:8006:9: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]

Make it return -ENOMEM for allocation failures and remove the unused variable instead.

Fixes 6db6e70a17f6 ("wifi: ath12k: Introduce the container for mac80211 hw")
Quoted 7 lines
Quoted 5 lines

Nathan already fixed this:

https://git.kernel.org/kvalo/ath/c/04edb5dc68f4

Patch set to Rejected.

Ok, sounds good. Nathan's patch looks fine to me

Great, thanks for checking.

Quoted 1 line

but I see it's not in linux-next yet as of today.

Yeah, it's a problem that ath.git is not included linux-next builds. The commits will be in linux-next only after ath-next is pulled to wireless-next :/

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw
Quoted 9 lines · Kalle Valo
Quoted 4 lines · Arnd Bergmann
Quoted 1 line · Kalle Valo

Arnd Bergmann <[email protected]> wrote:

but I see it's not in linux-next yet as of today.

Yeah, it's a problem that ath.git is not included linux-next builds. The commits will be in linux-next only after ath-next is pulled to wireless-next :/

Not sure if that is intentional, but if you'd like to change that, you can just email Stephen Rothwell asking him to include ath-next into linux-next as well.

Arnd

#5 lore raw
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Arnd Bergmann
Quoted 1 line · Kalle Valo

Arnd Bergmann <[email protected]> wrote:

but I see it's not in linux-next yet as of today.

Quoted 7 lines
Quoted 3 lines

Yeah, it's a problem that ath.git is not included linux-next builds. The commits will be in linux-next only after ath-next is pulled to wireless-next :/

Not sure if that is intentional, but if you'd like to change that, you can just email Stephen Rothwell asking him to include ath-next into linux-next as well.

We haven't done that as Stephen prefers that there are no "next-next" patches in linux-next during the merge window and we don't want to stop the development for two weeks.

But this is not the first time we get duplicate fixes due to the first fix not being in linux-next, so we should fix this. I guess we could do a similar for-next branch trick like we have in wireless-next? I'll talk with Jeff and we'll see what we can do.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches