]> www.infradead.org Git - users/jedix/linux-maple.git/commit
wifi: iwlwifi: mvm: remove unneeded NULL pointer checks
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 29 Dec 2024 14:44:42 +0000 (16:44 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 13 Jan 2025 14:26:42 +0000 (15:26 +0100)
commit79f4b6934dbd7dd6741726ba004a15e25380b8cc
tree1332b275cf46815c22d8448a3ef6e6921be51f2e
parent16b2092c4b26ddc266bf23f1d1c46cd032355b69
wifi: iwlwifi: mvm: remove unneeded NULL pointer checks

Smatch reported that we dereference the data pointer to calculate the
expected length before we check it's not NULL. While this is true (and
hence needs to be fixed), this will never happen because the data
pointer comes from struct iwl_rx_packet object which has the following
layout:

struct iwl_rx_packet {
        __le32 len_n_flags;
        struct iwl_cmd_header hdr;
        u8 data[];
} __packed;

So, if the pointer to iwl_rx_packet is valid, data will be valid as
well.

Remove the NULL pointer check on 'data' to avoid confusing smatch.
Also remove the check from similar functions in the same flow that were
cargo cult copy-pasted.

Fixes: 4635e6eaa0fe ("wifi: iwlwifi: mvm: support new versions of the wowlan APIs")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202411210812.0eLaonw3-lkp@intel.com/
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241229164246.c8ce6e041e4b.I4dc19289e3f3807386768c846e08be3ea322cd15@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/d3.c