netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUGFIX PATCH] net: ethernet: cpsw: fix erroneous condition in error check
@ 2013-03-21 12:20 Lothar Waßmann
  2013-03-21 12:32 ` Mugunthan V N
  0 siblings, 1 reply; 3+ messages in thread
From: Lothar Waßmann @ 2013-03-21 12:20 UTC (permalink / raw)
  To: Richard Cochran
  Cc: David S. Miller, netdev, linux-kernel, Mugunthan V N,
	Lothar Waßmann

The error check in cpsw_probe_dt() has an '&&' where an '||' is
meant to be. This causes a NULL pointer dereference when incomplet DT
data is passed to the driver ('phy_id' property for cpsw_emac1
missing).


Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/net/ethernet/ti/cpsw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 5ceaa4c3..7aebc0c 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1504,7 +1504,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
 		struct platform_device *mdio;
 
 		parp = of_get_property(slave_node, "phy_id", &lenp);
-		if ((parp == NULL) && (lenp != (sizeof(void *) * 2))) {
+		if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
 			pr_err("Missing slave[%d] phy_id property\n", i);
 			ret = -EINVAL;
 			goto error_ret;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-21 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-21 12:20 [BUGFIX PATCH] net: ethernet: cpsw: fix erroneous condition in error check Lothar Waßmann
2013-03-21 12:32 ` Mugunthan V N
2013-03-21 15:57   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).