From: AngeloGioacchino Del Regno <kholk11@gmail.com>
To: Colin King <colin.king@canonical.com>
Cc: Amit Kucheria <amit.kucheria@linaro.org>,
Andy Gross <agross@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <edubezval@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-pm@vger.kernel.org, MSM <linux-arm-msm@vger.kernel.org>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] thermal: qcom: tsens-v1: fix kfree of a non-pointer value
Date: Tue, 22 Oct 2019 14:39:42 +0200 [thread overview]
Message-ID: <CAK7fi1a8CiX=HVqhZSmQJdcjF1X_kdHFDwJhEpYJUcdPTcbMQA@mail.gmail.com> (raw)
In-Reply-To: <20191022111806.23143-1-colin.king@canonical.com>
Il giorno mar 22 ott 2019 alle ore 13:18 Colin King
<colin.king@canonical.com> ha scritto:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the kfree of pointer qfprom_cdata is kfreeing an
> error value that has been cast to a pointer rather than a
> valid address. Fix this by removing the kfree.
>
> Fixes: 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/thermal/qcom/tsens-v1.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
> index 2d1077b64887..bd2ddb684a45 100644
> --- a/drivers/thermal/qcom/tsens-v1.c
> +++ b/drivers/thermal/qcom/tsens-v1.c
> @@ -240,10 +240,8 @@ static int calibrate_8976(struct tsens_priv *priv)
> u32 *qfprom_cdata;
>
> qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
> - if (IS_ERR(qfprom_cdata)) {
> - kfree(qfprom_cdata);
> + if (IS_ERR(qfprom_cdata))
> return PTR_ERR(qfprom_cdata);
> - }
>
> mode = (qfprom_cdata[4] & MSM8976_CAL_SEL_MASK);
> dev_dbg(priv->dev, "calibration mode is %d\n", mode);
> --
> 2.20.1
>
I confirm that was one stupid mistake. I was about to send the same patch, and I
can confirm that this fix is working. Tested on my Xperia X Compact.
Tested-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
next prev parent reply other threads:[~2019-10-22 12:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 11:18 [PATCH][next] thermal: qcom: tsens-v1: fix kfree of a non-pointer value Colin King
2019-10-22 12:39 ` AngeloGioacchino Del Regno [this message]
2019-10-22 13:06 ` Amit Kucheria
2019-10-22 16:44 ` Srinivas Kandagatla
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='CAK7fi1a8CiX=HVqhZSmQJdcjF1X_kdHFDwJhEpYJUcdPTcbMQA@mail.gmail.com' \
--to=kholk11@gmail.com \
--cc=agross@kernel.org \
--cc=amit.kucheria@linaro.org \
--cc=colin.king@canonical.com \
--cc=daniel.lezcano@linaro.org \
--cc=edubezval@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.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).