aboutsummaryrefslogtreecommitdiff
path: root/net/wireless/core.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-02-21 00:04:20 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:54 -0500
commit85fd129a721e6e892dbaaf05203baf819730f699 (patch)
tree9e8563ce2e42ad4a6b426984b9067448a3a4129b /net/wireless/core.c
parentb5850a7a4fd5bcab4f6a2c49e5b4ab9ebb1d5d44 (diff)
cfg80211: add wiphy_idx_valid to check for wiphy_idx sanity
This will later be used by others, for now make use of it in cfg80211_drv_by_wiphy_idx() to return early if an invalid wiphy_idx has been provided. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r--net/wireless/core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 2b3e786ec53..35d457b2751 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -42,6 +42,9 @@ cfg80211_drv_by_wiphy_idx(int wiphy_idx)
{
struct cfg80211_registered_device *result = NULL, *drv;
+ if (!wiphy_idx_valid(wiphy_idx))
+ return NULL;
+
list_for_each_entry(drv, &cfg80211_drv_list, list) {
if (drv->wiphy_idx == wiphy_idx) {
result = drv;
@@ -225,7 +228,7 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)
drv->wiphy_idx = wiphy_counter++;
- if (unlikely(drv->wiphy_idx < 0)) {
+ if (unlikely(!wiphy_idx_valid(drv->wiphy_idx))) {
wiphy_counter--;
mutex_unlock(&cfg80211_drv_mutex);
/* ugh, wrapped! */