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] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 21 Dec 2013 12:25:50 -0200
From:	Fabio Estevam <festevam@...il.com>
To:	Shawn Guo <shawn.guo@...aro.org>
Cc:	Mark Brown <broonie@...nel.org>,
	Anson Huang <b20788@...escale.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Fabio Estevam <fabio.estevam@...escale.com>
Subject: Re: [PATCH 1/2] regulator: anatop-regulator: Remove unneeded check

On Sat, Dec 21, 2013 at 5:49 AM, Shawn Guo <shawn.guo@...aro.org> wrote:
> On Fri, Dec 20, 2013 at 11:42:09AM -0200, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@...escale.com>
>>
>> At the 'anatop_probe_end' error path, the variable 'ret' is known to be
>> non-zero, so there is no need to check it.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@...escale.com>
>> ---
>>  drivers/regulator/anatop-regulator.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
>> index c734d09..0a3597b 100644
>> --- a/drivers/regulator/anatop-regulator.c
>> +++ b/drivers/regulator/anatop-regulator.c
>> @@ -211,8 +211,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
>>       platform_set_drvdata(pdev, rdev);
>>
>>  anatop_probe_end:
>> -     if (ret)
>> -             kfree(sreg->name);
>> +     kfree(sreg->name);
>
> NAK
>
> With the change, a successful probe will end up with calling this
> kfree() as well.

I see. Then we can do this instead, so that the successful probe and
the error path are clearer:

--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -210,9 +210,10 @@ static int anatop_regulator_probe(struct platform_device *p

        platform_set_drvdata(pdev, rdev);

+       return 0;
+
 anatop_probe_end:
-       if (ret)
-               kfree(sreg->name);
+       kfree(sreg->name);

        return ret;
 }


Regards,

Fabio Estevam
--
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