From: Markus Elfring <Markus.Elfring@web.de>
To: Ethan Carter Edwards <ethan@ethancedwards.com>,
kernel-hardening@lists.openwall.com,
linux-hardening@vger.kernel.org, linux-sound@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] ASoC: q6dsp: q6apm: change kzalloc to kcalloc
Date: Sun, 9 Feb 2025 11:15:59 +0100 [thread overview]
Message-ID: <797c061c-7324-42e2-b4bd-fd93cf4ff0d0@web.de> (raw)
In-Reply-To: <s6duijftssuzy34ilogc5ggfyukfqxmbflhllyzjlu4ki3xoo4@ci57esahvmxn>
> 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
prev parent reply other threads:[~2025-02-09 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 1:32 [PATCH] ASoC: q6dsp: q6apm: change kzalloc to kcalloc Ethan Carter Edwards
2025-02-09 3:43 ` Ethan Carter Edwards
2025-02-09 10:15 ` Markus Elfring [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=797c061c-7324-42e2-b4bd-fd93cf4ff0d0@web.de \
--to=markus.elfring@web.de \
--cc=ethan@ethancedwards.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).