[PATCH] wifi: nl80211: drop impossible negative band check
From: Sun Jian
Date: Wed Feb 04 2026 - 03:18:50 EST
band is derived from nla_type() of a nested netlink attribute, which is
a masked u16 value and therefore cannot be negative. Drop the dead
"band < 0" checks and keep the upper bound validation.
No functional change intended.
Signed-off-by: Sun Jian <sun.jian.kdev@xxxxxxxxx>
---
net/wireless/nl80211.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 03efd45c007f..a92b4e24b28b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5759,7 +5759,7 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
enum nl80211_band band = nla_type(tx_rates);
int err;
- if (band < 0 || band >= NUM_NL80211_BANDS)
+ if (band >= NUM_NL80211_BANDS)
return -EINVAL;
sband = rdev->wiphy.bands[band];
if (sband == NULL)
@@ -10536,7 +10536,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
tmp) {
enum nl80211_band band = nla_type(attr);
- if (band < 0 || band >= NUM_NL80211_BANDS) {
+ if (band >= NUM_NL80211_BANDS) {
err = -EINVAL;
goto out_free;
}
--
2.43.0