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]
Message-ID: <YZ5RDnDNIsWz+TC2@smile.fi.intel.com>
Date:   Wed, 24 Nov 2021 16:49:50 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Johan Hovold <johan@...nel.org>, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] gpiolib: check the 'ngpios' property in core
 gpiolib code

On Wed, Nov 24, 2021 at 04:46:58PM +0200, Andy Shevchenko wrote:
> On Wed, Nov 24, 2021 at 01:28:50PM +0100, Bartosz Golaszewski wrote:
> > Several drivers read the 'ngpios' device property on their own, but
> > since it's defined as a standard GPIO property in the device tree bindings
> > anyway, it's a good candidate for generalization. If the driver didn't
> > set its gc->ngpio, try to read the 'ngpios' property from the GPIO
> > device's firmware node before bailing out.

...

> What about the modified suggestion from previous version:
> 
> 	if (gc->ngpio == 0) {
> 		ret = device_property_read_u32(&gdev->dev, "ngpios", &ngpios);
> 		/*
> 		 * -ENODATA means that there is no property found and
> 		 * we want to issue the error message to the user. Besides
> 		 * that, we want to return different error code to state
> 		 * that supplied value is not valid.
> 		 */
> 		if (ret == -ENODATA)
> 			ngpios = 0;
> 		else if (ret)
> 			return ret;
> 
> 		gc->ngpio = ngpios;
> 	}
> 
> 	if (gc->ngpio == 0) {
> 		chip_err(gc, "tried to insert a GPIO chip with zero lines\n");
> 		ret = -EINVAL;
> 		goto err_free_descs;
> 	}
> 
> ?

If you okay to go with this code,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ