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: <CAJZ5v0hR_0Do+jv79wxA4BRgrUKDfes2K5gYud9-2SoWOOEf0g@mail.gmail.com>
Date:   Wed, 3 Apr 2019 22:54:22 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] driver core: platform: Propagate error from insert_resource()

On Wed, Apr 3, 2019 at 1:29 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Tue, Apr 02, 2019 at 06:02:40PM +0200, Rafael J. Wysocki wrote:
> > On Tue, Apr 2, 2019 at 5:59 PM Andy Shevchenko
> > <andriy.shevchenko@...ux.intel.com> wrote:
> > >
> > > Since insert_resource() might return an error we don't need
> > > to shadow its error code and would safely propagate to the user.
>
> > > -               if (p && insert_resource(p, r)) {
> > > +               if (p && (ret = insert_resource(p, r))) {
> >
> > I would put the assignment here.
> >
> > >                         dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
> > > -                       ret = -EBUSY;
> > >                         goto failed;
> > >                 }
>
> Something like this?

Yes.

> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index dab0a5abc391..9cf9e2af9efd 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -438,10 +438,12 @@ int platform_device_add(struct platform_device *pdev)
>                                 p = &ioport_resource;
>                 }
>
> -               if (p && insert_resource(p, r)) {
> -                       dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
> -                       ret = -EBUSY;
> -                       goto failed;
> +               if (p) {
> +                       ret = insert_resource(p, r);
> +                       if (ret) {
> +                               dev_err(&pdev->dev, "failed to claim resource %d: %pR\n", i, r);
> +                               goto failed;
> +                       }
>                 }
>         }
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ