diff mbox series

wifi: mac80211: Fix potential he_6ghz_oper NULL pointer access

Message ID 20231122030237.31276-1-michael-cy.lee@mediatek.com
State New
Headers show
Series wifi: mac80211: Fix potential he_6ghz_oper NULL pointer access | expand

Commit Message

Michael-CY Lee Nov. 22, 2023, 3:02 a.m. UTC
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
---
 include/linux/ieee80211.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 3308e85..a23ec4c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2671,12 +2671,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))