mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH wireless 1/2] ath: dfs_pattern_detector: Fix a memory initialization issue
@ 2023-09-24  6:57 Christophe JAILLET
  2023-09-24  6:57 ` [PATCH wireless-next 2/2] ath: dfs_pattern_detector: Use flex array to simplify code Christophe JAILLET
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Christophe JAILLET @ 2023-09-24  6:57 UTC (permalink / raw)
  To: Kalle Valo, Christophe JAILLET
  Cc: linux-kernel, kernel-janitors, Kalle Valo, linux-wireless

If an error occurs and channel_detector_exit() is called, it relies on
entries of the 'detectors' array to be NULL.
Otherwise, it may access to un-initialized memory.

Fix it and initialize the memory, as what was done before the commit in
Fixes.

Fixes: a063b650ce5d ("ath: dfs_pattern_detector: Avoid open coded arithmetic in memory allocation")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Patch #1/2 is a fix, for for wireless.
Patch #2/2 is for wireless-next I guess, but depnds on #1

Not sure if we can mix different target in the same serie. Let me know.

BTW, sorry for messing up things with a063b650ce5d :(
---
 drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c
index 27f4d74a41c8..2788a1b06c17 100644
--- a/drivers/net/wireless/ath/dfs_pattern_detector.c
+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
@@ -206,7 +206,7 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq)
 
 	INIT_LIST_HEAD(&cd->head);
 	cd->freq = freq;
-	cd->detectors = kmalloc_array(dpd->num_radar_types,
+	cd->detectors = kcalloc(dpd->num_radar_types,
 				      sizeof(*cd->detectors), GFP_ATOMIC);
 	if (cd->detectors == NULL)
 		goto fail;
-- 
2.34.1


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

end of thread, other threads:[~2023-10-02 16:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-24  6:57 [PATCH wireless 1/2] ath: dfs_pattern_detector: Fix a memory initialization issue Christophe JAILLET
2023-09-24  6:57 ` [PATCH wireless-next 2/2] ath: dfs_pattern_detector: Use flex array to simplify code Christophe JAILLET
2023-09-26  0:45   ` Jeff Johnson
2023-09-25 18:46 ` [PATCH wireless 1/2] ath: dfs_pattern_detector: Fix a memory initialization issue Jeff Johnson
2023-09-25 20:54   ` Christophe JAILLET
2023-09-26  0:27     ` Jeff Johnson
2023-09-26  0:44 ` Jeff Johnson
2023-10-02 16:58 ` Kalle Valo

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

all inboxes | Powered by JetHome®