net: ethernet: cpsw: fix erroneous condition in error check
Subsystems (3)
PATCH 1/1 net: ethernet: cpsw: fix erroneous condition in error check
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).
--- drivers/net/ethernet/ti/cpsw.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/ti/cpsw.c +1 -1
@@ -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;
Signature · 1 line
1.7.2.5
Quoted 7 lines · 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 forcpsw_emac1missing).Signed-off-by Lothar Waßmann<[email protected]>
Regards
Mugunthan V N
From: Mugunthan V N <[email protected]>
Date: Thu, 21 Mar 2013 18:02:21 +0530
Quoted 9 lines · Lothar Waßmann
Quoted 7 lines
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 forcpsw_emac1missing).Signed-off-by Lothar Waßmann<[email protected]>Acked-by Mugunthan V N <[email protected]>
Applied, thanks.