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] [day] [month] [year] [list]
Date:	Tue, 29 Mar 2016 09:28:36 +0100
From:	Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
CC:	<nicolas.ferre@...el.com>, <davem@...emloft.net>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<patches@...nsource.wolfsonmicro.com>
Subject: Re: [PATCH] net: macb: Only call GPIO functions if there is a valid
 GPIO

On Mon, Mar 28, 2016 at 08:30:11PM +0300, Sergei Shtylyov wrote:
> >@@ -3029,7 +3030,8 @@ static int macb_remove(struct platform_device *pdev)
> >  		mdiobus_free(bp->mii_bus);
> >
> >  		/* Shutdown the PHY if there is a GPIO reset */
> >-		gpiod_set_value(bp->reset_gpio, 0);
> >+		if (bp->reset_gpio)
> >+			gpiod_set_value(bp->reset_gpio, 0);
> 
>    Hm, this function was previously OK to call with NULL (it didn't curse)...
> 

Looks like it was changed so that it does complain fairly
recently (patch librally snipped down):

commit fdeb8e1547cb9dd39d5d7223b33f3565cf86c28e
Author: Linus Walleij <linus.walleij@...aro.org>

    gpio: reflect base and ngpio into gpio_device


+#define VALIDATE_DESC_VOID(desc) do { \
+ if (!desc || !desc->gdev) { \
+         pr_warn("%s: invalid GPIO\n", __func__); \
+         return; \
+ } \
+

void gpiod_set_value(struct gpio_desc *desc, int value)
{
-   if (!desc)
-           return;
+ VALIDATE_DESC_VOID(desc);

Thanks,
Charles

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ