mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 10:11:38 -04:00
wifi: nl80211: use int for band coming from netlink
This was pointed out before, but there are issues with just removing the <0 check since enum representation isn't fixed, nla_type() returns int but really can only return small non-negative values, etc. Now newer versions of sparse are also starting to warn on it. Just use int for the band var. Link: https://patch.msgid.link/20260316123050.8c2d9f3426a0.I86acfa785982993fbffd148cc59049991bd6158f@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
@@ -5843,7 +5843,7 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
|
||||
*/
|
||||
BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN * 8);
|
||||
nla_for_each_nested(tx_rates, attrs[attr], rem) {
|
||||
enum nl80211_band band = nla_type(tx_rates);
|
||||
int band = nla_type(tx_rates);
|
||||
int err;
|
||||
|
||||
if (band < 0 || band >= NUM_NL80211_BANDS)
|
||||
@@ -10705,7 +10705,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
|
||||
nla_for_each_nested(attr,
|
||||
info->attrs[NL80211_ATTR_SCAN_SUPP_RATES],
|
||||
tmp) {
|
||||
enum nl80211_band band = nla_type(attr);
|
||||
int band = nla_type(attr);
|
||||
|
||||
if (band < 0 || band >= NUM_NL80211_BANDS) {
|
||||
err = -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user