Skip to contentSkip to conversation

wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

PATCH In review Alexey Berezhok 5 participants 15 messages Feb 8, 2024 – Feb 19, 2024 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -1
index 736b2ada6..63f6e9436 100644
@@ -5272,7 +5272,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
 					      settings->hidden_ssid);
 		if (err) {
 			bphy_err(drvr, "%s closednet error (%d)\n",
-				 settings->hidden_ssid ?
+				 (settings->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) ?
 				 "enabled" : "disabled",
 				 err);
 			goto exit;
Signature · 1 line
2.39.3
maintainer
#1 lore raw
Quoted 5 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Thanks, Alexey

Makes sense, but ....

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, · line 5272

Quoted 11 lines
---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +0 -0
index 736b2ada6..63f6e9436 100644
@@ -5272,7 +5272,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
  					      settings->hidden_ssid);

settings->hidden_ssid has already been used above in following call:

		err = brcmf_fil_iovar_int_set(ifp, "closednet",
					      settings->hidden_ssid);

So we pass the value as is to firmware using the same assumption, ie. NL80211_HIDDEN_SSID_NOT_IN_USE. Is this not ABI thus very unlikely to change?

@Johannes:
Actually not quite understanding the reason for having this setting in nl80211. hidden_ssid means SSID element length is zero, right?

Regards,
Arend

Quoted 7 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -1
  		if (err) {
  			bphy_err(drvr, "%s closednet error (%d)\n",
-				 settings->hidden_ssid ?
+				 (settings->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) ?
  				 "enabled" : "disabled",
  				 err);
  			goto exit;
#2 lore raw
Quoted 9 lines · Arend van Spriel

settings->hidden_ssid has already been used above in following call:

		err = brcmf_fil_iovar_int_set(ifp, "closednet",
					      settings->hidden_ssid);

So we pass the value as is to firmware using the same assumption, ie. NL80211_HIDDEN_SSID_NOT_IN_USE. Is this not ABI thus very unlikely to change?

The ABI won't change, that'd break all the users of nl80211 that use this :-)

Quoted 4 lines

@Johannes:
Actually not quite understanding the reason for having this setting in nl80211. hidden_ssid means SSID element length is zero, right?

Well, there at least _were_ APs doing the correct SSID length but setting all octets to zero ... Not sure that's still a thing though.

johannes

maintainer
#3 lore raw
Quoted 7 lines · Johannes Berg
Quoted 6 lines · Arend van Spriel

settings->hidden_ssid has already been used above in following call:

err = brcmf_fil_iovar_int_set(ifp, "closednet",
settings->hidden_ssid);

Quoted 6 lines
Quoted 3 lines

So we pass the value as is to firmware using the same assumption, ie. NL80211_HIDDEN_SSID_NOT_IN_USE. Is this not ABI thus very unlikely to change?

The ABI won't change, that'd break all the users of nl80211 that use this :-)

Right. So basically the assumption that NL80211_HIDDEN_SSID_NOT_IN_USE is and will be zero is a safe one.

Quoted 7 lines
Quoted 4 lines

@Johannes:
Actually not quite understanding the reason for having this setting in nl80211. hidden_ssid means SSID element length is zero, right?

Well, there at least _were_ APs doing the correct SSID length but setting all octets to zero ... Not sure that's still a thing though.

I now looked at the definition and see indeed two distinct flavours of "hidden SSID". Interesting although I have never considered it a useful feature.

Regards,
Arend

#4 lore raw
In reply to Alexey Berezhok
Quoted 7 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Patch applied to wireless-next.git, thanks.

f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
maintainer
#5 lore raw
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Quoted 7 lines
Quoted 3 lines

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Patch applied to wireless-next.git, thanks.

f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

Alexey,

Can you do a follow-up patch addressing my comment? If not I will do it myself.

Regards,
Arend
--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

#6 lore raw
Quoted 10 lines · Arend van Spriel
Quoted 9 lines · Kalle Valo
Quoted 7 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Quoted 8 lines
Quoted 3 lines

Patch applied to wireless-next.git, thanks.
f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

Alexey,

Can you do a follow-up patch addressing my comment? If not I will do it myself.

Sorry, was I not supposed to apply the patch? What did I miss?

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
maintainer
#7 lore raw
Quoted 16 lines · Kalle Valo
Quoted 14 lines · Arend van Spriel
Quoted 12 lines · Kalle Valo
Quoted 7 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Patch applied to wireless-next.git, thanks.
f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

Quoted 6 lines
Quoted 4 lines

Alexey,

Can you do a follow-up patch addressing my comment? If not I will do it myself.

Sorry, was I not supposed to apply the patch? What did I miss?

Nothing serious. settings->hidden_ssid value is used as-is to configure firmware. I wanted Alexey to address that in a v2.

Regards,
Arend

Quoted 5 lines

--
https://patchwork.kernel.org/project/linux-wireless/list/

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

#8 lore raw
Quoted 20 lines · Arend Van Spriel
Quoted 18 lines · Kalle Valo
Quoted 16 lines · Arend van Spriel
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Quoted 6 lines
Quoted 3 lines

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Patch applied to wireless-next.git, thanks.
f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

Alexey,

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Can you do a follow-up patch addressing my comment? If not I will do it myself.

Sorry, was I not supposed to apply the patch? What did I miss?

Nothing serious. settings->hidden_ssid value is used as-is to configure firmware. I wanted Alexey to address that in a v2.

My bad, I misunderstood your intentions. Luckily this time it wasn't serious.

BTW to make super clear to me I would prefer that you (Arend) use Acked-by. It shows up in my script like the number '1' here:

*[ 4] [next] wifi: carl9170: Remove redundant assignment t... 1 - - 2 5d Colin Ian Ki Under Review

So if I don't see your Acked-by then I will not even look at the patch :)

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
maintainer
#9 lore raw
Quoted 33 lines · Kalle Valo
Quoted 20 lines · Arend Van Spriel
Quoted 18 lines · Kalle Valo
Quoted 16 lines · Arend van Spriel
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Quoted 6 lines
Quoted 3 lines

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Patch applied to wireless-next.git, thanks.
f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

Alexey,

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Can you do a follow-up patch addressing my comment? If not I will do it myself.

Sorry, was I not supposed to apply the patch? What did I miss?

Nothing serious. settings->hidden_ssid value is used as-is to configure firmware. I wanted Alexey to address that in a v2.

My bad, I misunderstood your intentions. Luckily this time it wasn't serious.

Quoted 6 lines

BTW to make super clear to me I would prefer that you (Arend) use Acked-by. It shows up in my script like the number '1' here:

*[ 4] [next] wifi: carl9170: Remove redundant assignment t... 1 - - 2 5d Colin Ian Ki Under Review

So if I don't see your Acked-by then I will not even look at the patch :)

Sure. I tend to use Acked-by if things look sane a quick glance. If I need to dig further I prefer to use Reviewed-by. If I have comments to revise the patch I will refrain using them. Is that ok or you really want it to be Acked-by?

Regards,
Arend

#10 lore raw
Quoted 9 lines · Arend van Spriel
Quoted 8 lines

My bad, I misunderstood your intentions. Luckily this time it wasn't serious.
BTW to make super clear to me I would prefer that you (Arend) use Acked-by. It shows up in my script like the number '1' here:
*[ 4] [next] wifi: carl9170: Remove redundant assignment t... 1 - -
2 5d Colin Ian Ki Under Review
So if I don't see your Acked-by then I will not even look at the patch :)

Quoted 4 lines

Sure. I tend to use Acked-by if things look sane a quick glance. If I need to dig further I prefer to use Reviewed-by. If I have comments to revise the patch I will refrain using them. Is that ok or you really want it to be Acked-by?

Ah, now I understand better. My understanding is that the maintainer of the driver uses Acked-by and others use Reviewed-by. This says the same:

https://docs.kernel.org/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by

And yes, I would prefer if you could use Acked-by always. It's up to your judgement if you do just a peek or in-depth review :)

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
maintainer
#11 lore raw
Quoted 16 lines · Kalle Valo
Quoted 9 lines · Arend van Spriel
Quoted 8 lines

My bad, I misunderstood your intentions. Luckily this time it wasn't serious.
BTW to make super clear to me I would prefer that you (Arend) use Acked-by. It shows up in my script like the number '1' here:
*[ 4] [next] wifi: carl9170: Remove redundant assignment t... 1 - -
2 5d Colin Ian Ki Under Review
So if I don't see your Acked-by then I will not even look at the patch :)

Quoted 4 lines

Sure. I tend to use Acked-by if things look sane a quick glance. If I need to dig further I prefer to use Reviewed-by. If I have comments to revise the patch I will refrain using them. Is that ok or you really want it to be Acked-by?

Quoted 7 lines

Ah, now I understand better. My understanding is that the maintainer of the driver uses Acked-by and others use Reviewed-by. This says the same:

https://docs.kernel.org/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by

And yes, I would prefer if you could use Acked-by always. It's up to your judgement if you do just a peek or in-depth review :)

No problem. I think I can do that.

Regards,
Arend

#12 lore raw
In reply to Arend van Spriel
Quoted 13 lines · Arend van Spriel
Quoted 12 lines · Kalle Valo
Quoted 7 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Patch applied to wireless-next.git, thanks.

Quoted 10 lines
Quoted 1 line

f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

Alexey,

Can you do a follow-up patch addressing my comment? If not I will do it myself.

Regards,
Arend

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

Hello, do you mean this kind of modification:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -1
index 63f6e9436..d8f7bd5ce 100644
@@ -5269,7 +5269,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
                }
 
                err = brcmf_fil_iovar_int_set(ifp, "closednet",
-                                             settings->hidden_ssid);
+                                             (settings->hidden_ssid == NL80211_HIDDEN_SSID_NOT_IN_USE? 0 : 1));
                if (err) {
                        bphy_err(drvr, "%s closednet error (%d)\n",
                                 (settings->hidden_ssid != 

NL80211_HIDDEN_SSID_NOT_IN_USE) ?

If so, I will make additional patch.

Regards,
Alexey

maintainer
#13 lore raw
Quoted 44 lines · Alexey Berezhok
Quoted 18 lines · Arend van Spriel
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Alexey Berezhok

In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead. Compile tested only.

Quoted 8 lines
Quoted 3 lines

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Patch applied to wireless-next.git, thanks.

f20073f50dfd wifi: brcmfmac: do not cast hidden SSID attribute value to boolean

Alexey,

Quoted 7 lines

Can you do a follow-up patch addressing my comment? If not I will do it myself.

Regards,
Arend
--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

Hello, do you mean this kind of modification:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -1
index 63f6e9436..d8f7bd5ce 100644
@@ -5269,7 +5269,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy,
 struct net_device *ndev,
       }
 
       err = brcmf_fil_iovar_int_set(ifp, "closednet",
-                                             settings->hidden_ssid);
+                                             (settings->hidden_ssid ==
 NL80211_HIDDEN_SSID_NOT_IN_USE? 0 : 1));
       if (err) {
               bphy_err(drvr, "%s closednet error (%d)\n",
                        (settings->hidden_ssid !=
Quoted 3 lines

NL80211_HIDDEN_SSID_NOT_IN_USE) ?

If so, I will make additional patch.

That was indeed what I meant. Consider using local variable 'closednet' to pass in function call and use for error message.

Regards,
Arend

Quoted 2 lines

Regards,
Alexey

#14 lore raw
In reply to Alexey Berezhok

Thu, Feb 08, 2024 at 11:51:21AM +0300, Alexey Berezhok kirjoitti:

...

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, · line 5276

Quoted 3 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -1
-				 settings->hidden_ssid ?
+				 (settings->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) ?
 				 "enabled" : "disabled",

Can somebody switch this to use str_enabled_disabled() from string_choices.h? Ideally, add str_disabled_enabled() in that header (as macro with negation on its argument) and use here as

	str_disabled_enabled(settings->hidden_ssid == NL80211_HIDDEN_SSID_NOT_IN_USE)
Signature · 2 lines
With Best Regards,
Andy Shevchenko