[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <797c061c-7324-42e2-b4bd-fd93cf4ff0d0@web.de>
Date: Sun, 9 Feb 2025 11:15:59 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Ethan Carter Edwards <ethan@...ancedwards.com>,
kernel-hardening@...ts.openwall.com, linux-hardening@...r.kernel.org,
linux-sound@...r.kernel.org, linux-arm-msm@...r.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Takashi Iwai <tiwai@...e.com>
Subject: Re: [PATCH] ASoC: q6dsp: q6apm: change kzalloc to kcalloc
> We are replacing any instances of kzalloc(size * count, ...) with
> kcalloc(count, size, ...) due to risk of overflow [1].
See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.13#n94
…
> +++ b/sound/soc/qcom/qdsp6/q6apm.c
> @@ -230,7 +230,7 @@ int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, phys_a
> return 0;
> }
>
> - buf = kzalloc(((sizeof(struct audio_buffer)) * periods), GFP_KERNEL);
> + buf = kcalloc(periods, sizeof(struct audio_buffer), GFP_KERNEL);
…
See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.13#n941
How do you think about to increase the application of scope-based resource management?
Regards,
Markus
Powered by blists - more mailing lists