mac80211: fix spatial reuse size calculation mac80211-staging
authorJohn Crispin <john@phrozen.org>
Tue, 25 Feb 2020 07:18:37 +0000 (08:18 +0100)
committerJohn Crispin <john@phrozen.org>
Tue, 25 Feb 2020 07:19:16 +0000 (08:19 +0100)
The he_sr_control field is u8 so there is no need to do any endianess
conversion. Drop the conversion code and use he_sr_control directly.

Fixes: ef11a931bd1c ("mac80211: HE: add Spatial Reuse element parsing support")
Signed-off-by: John Crispin <john@phrozen.org>
include/linux/ieee80211.h

index 33d907eec0b60acd2fefc335ce480de1ca19781b..63d7a249ed78f482aa47818e5a60d046456307b4 100644 (file)
@@ -2111,17 +2111,15 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)
 {
        struct ieee80211_he_spr *he_spr = (void *)he_spr_ie;
        u8 spr_len = sizeof(struct ieee80211_he_spr);
-       u32 he_spr_params;
 
        /* Make sure the input is not NULL */
        if (!he_spr_ie)
                return 0;
 
        /* Calc required length */
-       he_spr_params = le32_to_cpu(he_spr->he_sr_control);
-       if (he_spr_params & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
+       if (he_spr->he_sr_control & IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
                spr_len++;
-       if (he_spr_params & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
+       if (he_spr->he_sr_control & IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT)
                spr_len += 18;
 
        /* Add the first byte (extension ID) to the total length */