lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e3d1aacd-ecbd-aa93-a547-11f89ca5f487@gmail.com>
Date:   Wed, 10 Mar 2021 20:09:26 +0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>, rui.zhang@...el.com,
        amitk@...nel.org
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] thermal: thermal_of: fix error return code of
 thermal_of_populate_bind_params()



On 2021/3/10 20:02, Daniel Lezcano wrote:
> 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@...nghua.edu.cn>
>> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.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 for the reply and advice.
I will send a new version of the patch to fix them both.


Best wishes,
Jia-Ju Bai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ