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:   Wed, 17 Oct 2018 10:58:23 -0400
From:   Sasha Levin <sashal@...nel.org>
To:     Nishad Kamdar <nishadkamdar@...il.com>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-iio@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org, outreachy-kernel@...glegroups.com
Subject: Re: [PATCH v2] staging: iio: ad7816: Switch to the gpio descriptor
 interface

On Wed, Oct 17, 2018 at 08:17:20PM +0530, Nishad Kamdar wrote:
>+	chip->rdwr_pin = devm_gpiod_get(&spi_dev->dev, "rdwr", GPIOD_IN);
>+	if (IS_ERR(chip->rdwr_pin)) {
>+		ret = PTR_ERR(chip->rdwr_pin);
>+		dev_err(&spi_dev->dev, "Failed to request rdwr GPIO: %d\n",
>+			ret);
> 		return ret;
> 	}
>-	gpio_direction_input(chip->rdwr_pin);
>-	ret = devm_gpio_request(&spi_dev->dev, chip->convert_pin,
>-				spi_get_device_id(spi_dev)->name);
>-	if (ret) {
>-		dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n",
>-			chip->convert_pin);
>+	chip->convert_pin = devm_gpiod_get(&spi_dev->dev, "convert", GPIOD_IN);
>+	if (IS_ERR(chip->convert_pin)) {
>+		ret = PTR_ERR(chip->convert_pin);
>+		dev_err(&spi_dev->dev, "Failed to request convert GPIO: %d\n",
>+			ret);
> 		return ret;
> 	}
>-	gpio_direction_input(chip->convert_pin);
>-	ret = devm_gpio_request(&spi_dev->dev, chip->busy_pin,
>-				spi_get_device_id(spi_dev)->name);
>-	if (ret) {
>-		dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n",
>-			chip->busy_pin);
>+	chip->busy_pin = devm_gpiod_get(&spi_dev->dev, "busy", GPIOD_IN);
>+	if (IS_ERR(chip->busy_pin)) {
>+		ret = PTR_ERR(chip->busy_pin);
>+		dev_err(&spi_dev->dev, "Failed to request busy GPIO: %d\n",
>+			ret);
> 		return ret;
> 	}

Hm, from what I can tell devm_gpio_request() is allocating some memory,
which makes this a series of 4 allocations.

What happens if the fourth allocation fails? Do we leak the first three?

--
Thanks,
Sasha

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ