Skip to content

Commit

Permalink
[POWERPC] mpc5200-fec: Fix possible NULL dereference in mdio driver
Browse files Browse the repository at this point in the history
If the reg property is missing from the phy node (unlikely, but possible),
then the kernel will oops with a NULL pointer dereference.  This fixes
it by checking the pointer first.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Grant Likely authored and Paul Mackerras committed Mar 24, 2008
1 parent 1428a9f commit b8c19eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/fec_mpc52xx_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_i
int irq = irq_of_parse_and_map(child, 0);
if (irq != NO_IRQ) {
const u32 *id = of_get_property(child, "reg", NULL);
bus->irq[*id] = irq;
if (id)
bus->irq[*id] = irq;
}
}

Expand Down

0 comments on commit b8c19eb

Please sign in to comment.