The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH next] wifi: iwlwifi: Fix uninitialized variable with __free()
@ 2025-03-12  8:31 Dan Carpenter
  2025-03-12  9:37 ` Korenblit, Miriam Rachel
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dan Carpenter @ 2025-03-12  8:31 UTC (permalink / raw)
  To: Miri Korenblit
  Cc: Johannes Berg, Anjaneyulu, Emmanuel Grumbach, Avraham Stern,
	Yedidya Benshimol, Daniel Gabay, linux-wireless, linux-kernel,
	kernel-janitors

Pointers declared with the __free(kfree) attribute need to be initialized
because they will be passed to kfree() on every return path.  There are
two return statement before the "cmd" pointer is initialized so this
leads to an uninitialized variable bug.

Fixes: d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/wireless/intel/iwlwifi/mld/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mld/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mld/debugfs.c
index c759c5c68dc0..1d4b2ad5d388 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/debugfs.c
@@ -556,8 +556,8 @@ iwl_dbgfs_vif_twt_setup_write(struct iwl_mld *mld, char *buf, size_t count,
 	};
 	struct ieee80211_vif *vif = data;
 	struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
+	struct iwl_dhc_cmd *cmd __free(kfree) = NULL;
 	struct iwl_dhc_twt_operation *dhc_twt_cmd;
-	struct iwl_dhc_cmd *cmd __free(kfree);
 	u64 target_wake_time;
 	u32 twt_operation, interval_exp, interval_mantissa, min_wake_duration;
 	u8 trigger, flow_type, flow_id, protection, tenth_param;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-03-13 17:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12  8:31 [PATCH next] wifi: iwlwifi: Fix uninitialized variable with __free() Dan Carpenter
2025-03-12  9:37 ` Korenblit, Miriam Rachel
2025-03-12 15:15 ` Jeff Johnson
2025-03-12 15:24   ` Dan Carpenter
2025-03-13 17:43     ` Jeff Johnson
2025-03-12 19:27   ` Korenblit, Miriam Rachel
2025-03-12 15:42 ` [PATCH] " Markus Elfring
2025-03-12 19:32   ` Korenblit, Miriam Rachel
2025-03-12 20:16     ` Markus Elfring
2025-03-12 20:32       ` Korenblit, Miriam Rachel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox