Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756918Ab3CUMUX (ORCPT ); Thu, 21 Mar 2013 08:20:23 -0400 Received: from mail.karo-electronics.de ([81.173.242.67]:60420 "EHLO mail.karo-electronics.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753080Ab3CUMUW (ORCPT ); Thu, 21 Mar 2013 08:20:22 -0400 X-Greylist: delayed 412 seconds by postgrey-1.27 at vger.kernel.org; Thu, 21 Mar 2013 08:20:22 EDT From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: Richard Cochran Cc: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Mugunthan V N , =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= Subject: [BUGFIX PATCH] net: ethernet: cpsw: fix erroneous condition in error check Date: Thu, 21 Mar 2013 13:20:11 +0100 Message-Id: <1363868411-25318-1-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 1.7.2.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1184 Lines: 32 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/