diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2023-09-30 07:54:47 +0300 |
---|---|---|
committer | Kalle Valo <quic_kvalo@quicinc.com> | 2023-10-02 19:58:33 +0300 |
commit | 79bd60ee87e1136718a686d6617ced5de88ee350 (patch) | |
tree | dd1c49736f461efffa6791b2d6241db87d3ab883 /drivers/net/wireless/ath/dfs_pattern_detector.c | |
parent | 6c751f1a7bb864bcb93b2148a09d476706427144 (diff) | |
download | linux-79bd60ee87e1136718a686d6617ced5de88ee350.tar.xz |
wifi: ath: dfs_pattern_detector: Fix a memory initialization issue
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>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/ad8c55b97ee4b330cb053ce2c448123c309cc91c.1695538105.git.christophe.jaillet@wanadoo.fr
Diffstat (limited to 'drivers/net/wireless/ath/dfs_pattern_detector.c')
-rw-r--r-- | drivers/net/wireless/ath/dfs_pattern_detector.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |