From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-wireless@vger.kernel.org
Subject: [bug report] nl80211/cfg80211: add radar detection command/event
Date: Thu, 20 Dec 2018 14:17:26 +0300 [thread overview]
Message-ID: <20181220111726.GA19146@kadam> (raw)
Hi wireless devs,
The patch 04f39047af2a: "nl80211/cfg80211: add radar detection
command/event" from Feb 8, 2013, leads to the following static
checker warning:
net/wireless/chan.c:250 cfg80211_set_chans_dfs_state()
warn: 'center_freq + bandwidth / 2 - 10' negative user limit promoted to high
net/wireless/chan.c
242 static void cfg80211_set_chans_dfs_state(struct wiphy *wiphy, u32 center_freq,
243 u32 bandwidth,
244 enum nl80211_dfs_state dfs_state)
245 {
246 struct ieee80211_channel *c;
247 u32 freq;
248
249 for (freq = center_freq - bandwidth/2 + 10;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
250 freq <= center_freq + bandwidth/2 - 10;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This isn't really a big issue but center_freq comes from
nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]) in nl80211_parse_chandef().
Smatch is complaining that there is an issue with the math
over/underflowing. It just means that we loop for a long time. It's
not a security problem. Even without the overflow, we could end up
looping for a long time.
Is center_freq capped somewhere that I haven't seen?
251 freq += 20) {
252 c = ieee80211_get_channel(wiphy, freq);
253 if (!c || !(c->flags & IEEE80211_CHAN_RADAR))
254 continue;
255
256 c->dfs_state = dfs_state;
257 c->dfs_state_entered = jiffies;
258 }
259 }
regards,
dan carpenter
next reply other threads:[~2018-12-20 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-20 11:17 Dan Carpenter [this message]
2018-12-20 14:16 ` [bug report] nl80211/cfg80211: add radar detection command/event Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181220111726.GA19146@kadam \
--to=dan.carpenter@oracle.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.