[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82bb39d1-c3a9-a8d1-9d96-f4d6d6b0f042@codeaurora.org>
Date: Thu, 20 Aug 2020 09:25:33 +0530
From: Rohit Kumar <rohitkr@...eaurora.org>
To: Colin King <colin.king@...onical.com>,
Patrick Lai <plai@...eaurora.org>,
Banajit Goswami <bgoswami@...eaurora.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Ajit Pandey <ajitp@...eaurora.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
alsa-devel@...a-project.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] ASoC: qcom: add missing out of memory check on
drvdata->clks allocation
On 8/19/2020 9:31 PM, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> Currently drvdata->clks is not being checked for an allocation failure,
> leading to potential null pointer dereferencing. Fix this by adding a
> check and returning -ENOMEM if an error occurred.
>
> Addresses-Coverity: ("Dereference null return value")
> Fixes: 1220f6a76e77 ("ASoC: qcom: Add common array to initialize soc based core clocks")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
Thanks for the fix.
Reviewed-by: Rohit kumar <rohitkr@...eaurora.org>
> sound/soc/qcom/lpass-apq8016.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
> index dd9e3dd014f6..5c8ae225cd5d 100644
> --- a/sound/soc/qcom/lpass-apq8016.c
> +++ b/sound/soc/qcom/lpass-apq8016.c
> @@ -168,6 +168,8 @@ static int apq8016_lpass_init(struct platform_device *pdev)
>
> drvdata->clks = devm_kcalloc(dev, variant->num_clks,
> sizeof(*drvdata->clks), GFP_KERNEL);
> + if (!drvdata->clks)
> + return -ENOMEM;
> drvdata->num_clks = variant->num_clks;
>
> for (i = 0; i < drvdata->num_clks; i++)
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member
of the Code Aurora Forum, hosted by the Linux Foundation.
Powered by blists - more mailing lists