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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 21 Feb 2014 11:42:55 +0100
From:	Krzysztof Kozlowski <k.kozlowski@...sung.com>
To:	Sachin Kamat <sachin.kamat@...aro.org>
Cc:	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] regulator: max14577: Fix invalid return value on DT parse
 success

On Fri, 2014-02-21 at 15:54 +0530, Sachin Kamat wrote:
> Hi Krzysztof,
> 
> On 20 February 2014 20:49, Krzysztof Kozlowski <k.kozlowski@...sung.com> wrote:
> > This fixes bug introduced in 667a6b7a (regulator: max14577: Add missing
> > of_node_put). The DTS parsing function returned number of matched
> > regulators as success status which then was compared against 0 in probe.
> >
> > Result was a probe fail after successful parsing the DTS:
> > max14577-regulator: probe of max14577-regulator failed with error 2
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@...sung.com>
> > ---
> >  drivers/regulator/max14577.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/regulator/max14577.c b/drivers/regulator/max14577.c
> > index 186df8785a91..6ba11a8dd23d 100644
> > --- a/drivers/regulator/max14577.c
> > +++ b/drivers/regulator/max14577.c
> > @@ -168,11 +168,13 @@ static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev)
> >                         MAX14577_REG_MAX);
> >         if (ret < 0) {
> >                 dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret);
> > +               of_node_put(np);
> > +               return ret;
> >         }
> >
> >         of_node_put(np);
> >
> > -       return ret;
> > +       return 0;
> >  }
> 
> Instead of so many changes here, you could simply make the following change
> in the max14577_regulator_probe function.
> 
> ret = max14577_regulator_dt_parse_pdata(pdev);
> if (ret < 0)
>         return ret;

That still wouldn't be sufficient because later in probe() the 'ret' is
not reassigned (if devm_regulator_register succeeds) and it is directly
returned at the probe() end. So still the number of matched regulators
would be returned as probe result.

Best regards,
Krzysztof

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