Skip to content

Commit ef58288

Browse files
Michael-CY Leejmberg-intel
authored andcommitted
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>
1 parent 1033176 commit ef58288

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

include/linux/ieee80211.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2830,12 +2830,14 @@ ieee80211_he_oper_size(const u8 *he_oper_ie)
28302830
static inline const struct ieee80211_he_6ghz_oper *
28312831
ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper)
28322832
{
2833-
const u8 *ret = (const void *)&he_oper->optional;
2833+
const u8 *ret;
28342834
u32 he_oper_params;
28352835

28362836
if (!he_oper)
28372837
return NULL;
28382838

2839+
ret = (const void *)&he_oper->optional;
2840+
28392841
he_oper_params = le32_to_cpu(he_oper->he_oper_params);
28402842

28412843
if (!(he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO))

0 commit comments

Comments
 (0)