[PATCH 1/8] wifi: wilc1000: fix incorrect type assignment sparse warning

Jouni Malinen j at w1.fi
Thu Oct 13 02:40:11 PDT 2022


On Thu, Oct 13, 2022 at 09:39:56AM +0200, Johannes Berg wrote:
> On Wed, 2022-07-27 at 17:32 +0000, Ajay.Kathat at microchip.com wrote:
> > I think, there is an another way to handle this issue. 'key_mgmt_suite' 
> > element in 'cfg80211_external_auth_params' struct should be converted to 
> > '__be32' type(like below code snippet) because wpa_s expects the value 
> > in big-endian format . After this change, the type case can be avoided. 
> > Though I am not sure if these changes can have impact on other driver.
> > 
> 
> Ugh. I think maybe it would be better to fix wpa_supplicant?

Assuming you are referring to what sme_external_auth_trigger() does,
yes, the use of RSN_SELECTOR_GET() there on an unsigned int variable is
clearly wrong. As a workaround, it could be modified to accept both the
big endian and host byte order since the risk of conflicting with a
vendor specific AKM suite here would be very minimal.. Furthermore, it
looks like this has missed the new RSN_AUTH_KEY_MGMT_SAE_EXT_KEY
selector update as well.

> Thing is, we use the NL80211_ATTR_AKM_SUITES attribute here for it, and
> even wpa_supplicant mostly uses that in host endian:

By the way, that use of a u32 attribute (or an array of such) in an
interface is quite confusing for suite selectors (both AKM and cipher)
since a suite selector is really a four octet binary string that starts
with three octet OUI that is followed with a single octet integer
value. nl80211.h does not seem to provide any documentation on what the
exact value is supposed to be.

I can understand use of u32 and native byte order as an implementation
internal thing, but it should not really be used in an interface since
it is just waiting for this type of issues to show up. It's always
confusing to review the driver_nl80211* changes for this area since I
have to convince myself each time that this really is a native byte
order u32 value.. That sme_external_auth_trigger() case is outside
driver_nl80211* so it did not get the same detail of review
unfortunately.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list