[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260204081821.730673-1-sun.jian.kdev@gmail.com>
Date: Wed, 4 Feb 2026 16:18:21 +0800
From: Sun Jian <sun.jian.kdev@...il.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org,
Sun Jian <sun.jian.kdev@...il.com>
Subject: [PATCH] wifi: nl80211: drop impossible negative band check
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@...il.com>
---
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
Powered by blists - more mailing lists