[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <164242331548.27899.9932446295681799332.kvalo@kernel.org>
Date: Mon, 17 Jan 2022 12:41:56 +0000 (UTC)
From: Kalle Valo <kvalo@...nel.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: davem@...emloft.net, kuba@...nel.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: Re: [PATCH] ath: dfs_pattern_detector: Avoid open coded arithmetic in
memory allocation
Christophe JAILLET <christophe.jaillet@...adoo.fr> wrote:
> kmalloc_array()/kcalloc() should be used to avoid potential overflow when
> a multiplication is needed to compute the size of the requested memory.
>
> kmalloc_array() can be used here instead of kcalloc() because the array is
> fully initialized in the next 'for' loop.
>
> Finally, 'cd->detectors' is defined as 'struct pri_detector **detectors;'.
> So 'cd->detectors' and '*cd->detectors' are both some pointer.
> So use a more logical 'sizeof(*cd->detectors)'.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> Signed-off-by: Kalle Valo <quic_kvalo@...cinc.com>
Patch applied to ath-next branch of ath.git, thanks.
a063b650ce5d ath: dfs_pattern_detector: Avoid open coded arithmetic in memory allocation
--
https://patchwork.kernel.org/project/linux-wireless/patch/0fbcd32a0384ac1f87c5a3549e505e4becc60226.1640624216.git.christophe.jaillet@wanadoo.fr/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists