staging: wilc1000: off by one in wilc_wfi_cfg80211_mgmt_types
authorSasha Levin <sasha.levin@oracle.com>
Thu, 28 May 2015 15:03:56 +0000 (11:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 00:00:15 +0000 (09:00 +0900)
NL80211_IFTYPE_MAX represents the largest interface type number defined,
so declaring the array with that size will actually leave out the last
interface.

This causes invalid memory access whenever this array is used, which starts
happening at boot.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h

index 508db6a3f6dd5dc083cc8eb0dc11c0b4237773d8..829ba32ea210f1e9193a46cb0b285c9808ecaf75 100644 (file)
@@ -77,7 +77,7 @@ static const u32 cipher_suites[] = {
 };
 
 static const struct ieee80211_txrx_stypes
-       wilc_wfi_cfg80211_mgmt_types[NL80211_IFTYPE_MAX] = {
+       wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
        [NL80211_IFTYPE_STATION] = {
                .tx = 0xffff,
                .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |