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: <20160413.220313.1257029315478740404.davem@davemloft.net>
Date:	Wed, 13 Apr 2016 22:03:13 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	andrew@...n.ch
Cc:	f.fainelli@...il.com, netdev@...r.kernel.org,
	vivien.didelot@...oirfairelinux.com
Subject: Re: [PATCH net-next 4/8] dsa: Move gpio reset into switch driver

From: Andrew Lunn <andrew@...n.ch>
Date: Thu, 14 Apr 2016 01:59:54 +0200

> @@ -3178,6 +3178,7 @@ int mv88e6xxx_probe(struct mdio_device *mdiodev, struct dsa_switch_driver *ops,
>  	struct mv88e6xxx_priv_state *ps;
>  	struct dsa_switch *ds;
>  	const char *name;
> +	int err;
>  
>  	ds = devm_kzalloc(dev, sizeof(*ds) + sizeof(*ps), GFP_KERNEL);
>  	if (!ds)
> @@ -3199,6 +3200,17 @@ int mv88e6xxx_probe(struct mdio_device *mdiodev, struct dsa_switch_driver *ops,
>  		return -ENODEV;
>  	}
>  
> +	ps->reset = devm_gpiod_get(&mdiodev->dev, "reset", GPIOD_ASIS);
> +	err = PTR_ERR(ps->reset);
> +	if (err) {
> +		if (err == -ENOENT) {
> +			/* Optional, so not an error */
> +			ps->reset = NULL;
> +		} else {
> +			return err;
> +		}
> +	}

PTR_ERR() just casts the pointer into an integer, regardless of it's
value, and regardless of whether it is an error code or a real pointer
successfully returned from devm_gpiod_get().

So I don't think this code is correct.

You need an IS_ERR() check in there somewhere.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ