Skip to contentSkip to conversation

mac80211_hwsim: Send alpha2 only if non-zero

PATCH In review Patrik Flykt 2 participants 2 messages Nov 21, 2014 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211_hwsim: Send alpha2 only if non-zero

A properly set alpha2 value consists of two chars that both contain letters or digits. If no value is set, both chars keep their initial value zero. Therefore do not send the alpha2 parameter to user space if either of the characters has been left at its initial zero value.

---

This is a fix for the issue Johannes noted with the patch adding HWSIM_CMD_GET_RADIO support.

Cheers,

Patrik

 drivers/net/wireless/mac80211_hwsim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +3 -1
index e23a8d1..d399a73 100644
@@ -2541,7 +2541,9 @@ static int mac80211_hwsim_get_radio(struct sk_buff *skb,
 	if (cb)
 		genl_dump_check_consistent(cb, hdr, &hwsim_genl_family);
 
-	param.reg_alpha2 = data->alpha2;
+	if (data->alpha2[0] && data->alpha2[1])
+		param.reg_alpha2 = data->alpha2;
+
 	param.reg_strict = !!(data->hw->wiphy->regulatory_flags &
 					REGULATORY_STRICT_REG);
 	param.p2p_device = !!(data->hw->wiphy->interface_modes &
Signature · 1 line
2.1.1
maintainer
#1 lore raw
Quoted 10 lines · Patrik Flykt

A properly set alpha2 value consists of two chars that both contain letters or digits. If no value is set, both chars keep their initial value zero. Therefore do not send the alpha2 parameter to user space if either of the characters has been left at its initial zero value.

---

This is a fix for the issue Johannes noted with the patch adding HWSIM_CMD_GET_RADIO support.

Interesting. I must have left the patch applied by accident. Oh well, I'll apply this as well :)

johannes