From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>,
rui.zhang@intel.com, amitk@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thermal: thermal_of: fix error return code of thermal_of_populate_bind_params()
Date: Wed, 10 Mar 2021 13:02:36 +0100 [thread overview]
Message-ID: <ac49897d-fdcd-57aa-fb1a-2bf7f3b2296d@linaro.org> (raw)
In-Reply-To: <20210306141106.18695-1-baijiaju1990@gmail.com>
On 06/03/2021 15:11, Jia-Ju Bai wrote:
> When kcalloc() fails and __tcbp is NULL, no error return code of
> thermal_of_populate_bind_params() is assigned.
> To fix this bug, ret is assigned with -ENOMEM in this case.
>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/thermal/thermal_of.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 69ef12f852b7..e8c9041482e9 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -710,8 +710,10 @@ static int thermal_of_populate_bind_params(struct device_node *np,
> }
>
> __tcbp = kcalloc(count, sizeof(*__tcbp), GFP_KERNEL);
> - if (!__tcbp)
> + if (!__tcbp) {
> + ret = -ENOMEM;
> goto end;
> + }
Thank you for your patch.
Seems like the same happens a few lines before:
count = of_count_phandle_with_args(np, "cooling-device",
"#cooling-cells");
if (!count) {
pr_err("Add a cooling_device property with at least one
device\n");
goto end;
}
Mind to send a patch fixing both ?
Thanks
-- Daniel
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2021-03-10 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 14:11 Jia-Ju Bai
2021-03-10 12:02 ` Daniel Lezcano [this message]
2021-03-10 12:09 ` Jia-Ju Bai
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=ac49897d-fdcd-57aa-fb1a-2bf7f3b2296d@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amitk@kernel.org \
--cc=baijiaju1990@gmail.com \
--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
all inboxes | Powered by JetHome®