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: <5334C7E0.8050803@samsung.com>
Date:	Fri, 28 Mar 2014 09:52:48 +0900
From:	Chanwoo Choi <cw00.choi@...sung.com>
To:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Cc:	dbaryshkov@...il.com, dwmw2@...radead.org,
	myungjoo.ham@...sung.com, kyungmin.park@...sung.com,
	linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH] charger-manager: Fix checking of wrong return type

Hi,

On 03/28/2014 01:52 AM, Bartlomiej Zolnierkiewicz wrote:
> 
> Hi,
> 
> On Thursday, March 27, 2014 08:56:55 PM Chanwoo Choi wrote:
>> This patch fix minor issue about checking wrong return type.
>>
>> The of_cm_parse_desc() return ERR_PTR(errnor number) when some error happen
>> in this function. But, charger_manager_probe() has only checked whether
>> desc is NULL or not. If of_cm_parse_desc() returns ERR_PTR(-ENOMEM), desc
>> isn't NULL but desc is (void *)(-ENOMEM). Althouhg some error happen for parsing
>> DT, charger_manager_probe() can't detect error of desc instance.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
>> Signed-off-by: Myungjoo Ham <myungjoo.ham@...sung.com>
>> ---
>>  drivers/power/charger-manager.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
>> index 9e4dab4..a10fb57 100644
>> --- a/drivers/power/charger-manager.c
>> +++ b/drivers/power/charger-manager.c
>> @@ -1677,7 +1677,7 @@ static int charger_manager_probe(struct platform_device *pdev)
>>  		}
>>  	}
>>  
>> -	if (!desc) {
>> +	if (IS_ERR(desc)) {
>>  		dev_err(&pdev->dev, "No platform data (desc) found\n");
>>  		return -ENODEV;
> 
> While you are at it you may also fix the code to return the proper error
> code.  of_cm_parse_desc() currently returns -ENOMEM not -ENODEV but it
> would be even better to decode the actual return code from desc by using
> 'return PTR_ERR(desc)' instead of 'return -ENODEV'.

I'll resend this patch after fix it.

Thanks,
Chanwoo Choi


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ