wifi: nl80211: move WPA version validation to policy
authorJohannes Berg <johannes.berg@intel.com>
Mon, 29 Jan 2024 18:54:21 +0000 (19:54 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 2 Feb 2024 13:20:43 +0000 (14:20 +0100)
commit57d1b4632e03e5f938972055c45b0f2e475e6929
treed954bc05cb25fa323f3c53e82b85b31c6f815f61
parent392d3dfdfd68f4be6964d4fc8f3979a7a859e6f2
wifi: nl80211: move WPA version validation to policy

For a contiguous mask (starting with bit 0) of allowed values
in a bitmap, it's equivalent to check "!(val & ~mask)" and
"val ∈ [0, mask]". Use that to move the WPA versions check to
the policy, for better error reporting.

Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://msgid.link/20240129195421.e8cae9866ccb.I2539b395e3476307d702c6867e51a937e52e57a0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c