Re: [PATCH] Fix possible NULL Pointer Dereference in 'asoc_qcom_lpass_cpu_platform_probe'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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@xxxxxxxxx>
> Reported-by: Zichen Xie <zichenxie0106@xxxxxxxxx>
…

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




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux