diff options
author | Michael-CY Lee <michael-cy.lee@mediatek.com> | 2023-11-22 06:02:37 +0300 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2023-11-24 20:37:34 +0300 |
commit | ef5828805842204dd0259ecfc132b5916c8a77ae (patch) | |
tree | 445b1d9a3ab5a75468cb1f0a8ac2786118a44949 /include/linux/ieee80211.h | |
parent | 103317670e6bf2542309db28d52444a83d84ed28 (diff) | |
download | linux-ef5828805842204dd0259ecfc132b5916c8a77ae.tar.xz |
wifi: avoid offset calculation on NULL pointer
ieee80211_he_6ghz_oper() can be passed a NULL pointer
and checks for that, but already did the calculation
to inside of it before. Move it after the check.
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Link: https://lore.kernel.org/r/20231122030237.31276-1-michael-cy.lee@mediatek.com
[rewrite commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r-- | include/linux/ieee80211.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 958771bac9c0..c2ac9e9e7ee9 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -2830,12 +2830,14 @@ ieee80211_he_oper_size(const u8 *he_oper_ie) static inline const struct ieee80211_he_6ghz_oper * ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper) { - const u8 *ret = (const void *)&he_oper->optional; + const u8 *ret; u32 he_oper_params; if (!he_oper) return NULL; + ret = (const void *)&he_oper->optional; + he_oper_params = le32_to_cpu(he_oper->he_oper_params); if (!(he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO)) |