Commit ef582880 authored by Michael-CY Lee's avatar Michael-CY Lee Committed by Johannes Berg
Browse files

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: default avatarMichael-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: default avatarJohannes Berg <johannes.berg@intel.com>
parent 10331767
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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))