From: Markus Elfring <Markus.Elfring@web.de>
To: Zichen Xie <zichenxie0106@gmail.com>,
alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
linux-arm-msm@vger.kernel.org, Jaroslav Kysela <perex@perex.cz>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Rohit kumar <quic_rohkumar@quicinc.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Takashi Iwai <tiwai@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Zijie Zhao <zzjas98@gmail.com>,
Chenyuan Yang <chenyuan0y@gmail.com>
Subject: Re: [PATCH] Fix possible NULL Pointer Dereference in 'asoc_qcom_lpass_cpu_platform_probe'
Date: Mon, 30 Sep 2024 18:33:49 +0200 [thread overview]
Message-ID: <30cfc980-3b38-4e98-a753-b149746cf93c@web.de> (raw)
In-Reply-To: <20240930011521.26283-1-zichenxie0106@gmail.com>
> A 'devm_kzalloc' in 'asoc_qcom_lpass_cpu_platform_probe' could possibly return NULL pointer.
> NULL Pointer Dereference may be triggerred in 'asoc_qcom_lpass_cpu_platform_probe' without addtional check.
> Add a null check for the returned pointer.
How do you think about a wording variant like the following?
The result from a call of the function “devm_kzalloc” was passed to
a subsequent function call without checking for a null pointer before
(according to a memory allocation failure).
Thus return directly after a failed devm_kzalloc() call.
…
> Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
> Reported-by: Zichen Xie <zichenxie0106@gmail.com>
…
How good does such a tag combination fit together for the same person?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc1#n525
Can a subject like “[PATCH] ASoC: qcom: lpass-cpu: Return directly after a failed devm_kzalloc() call
in asoc_qcom_lpass_cpu_platform_probe()” be more appropriate?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc1#n613
…
> +++ b/sound/soc/qcom/lpass-cpu.c
> @@ -1243,6 +1243,9 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
> drvdata->i2sctl = devm_kzalloc(&pdev->dev, sizeof(struct lpaif_i2sctl),
> GFP_KERNEL);
>
> + if (!drvdata->i2sctl)
> + return -ENOMEM;
…
I suggest to omit a blank line here.
By the way:
Would you become interested to omit the label “err” from this function implementation finally?
Regards,
Markus
next prev parent reply other threads:[~2024-09-30 16:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 1:15 [PATCH] Fix possible NULL Pointer Dereference in 'asoc_qcom_lpass_cpu_platform_probe' Gax-c
2024-09-30 16:33 ` Markus Elfring [this message]
2024-09-30 18:16 ` Mark Brown
2024-10-01 5:30 ` Markus Elfring
2024-09-30 17:12 ` [PATCH] " Bjorn Andersson
2024-10-01 12:48 ` Markus Elfring
2024-10-01 12:58 ` Mark Brown
2024-10-01 19:44 ` Krzysztof Kozlowski
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=30cfc980-3b38-4e98-a753-b149746cf93c@web.de \
--to=markus.elfring@web.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=chenyuan0y@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=quic_rohkumar@quicinc.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
--cc=zichenxie0106@gmail.com \
--cc=zzjas98@gmail.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