From: Grant Likely Date: Sat, 22 Mar 2008 03:20:29 +0000 (+1100) Subject: [POWERPC] mpc5200-fec: Fix possible NULL dereference in mdio driver X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b8c19eb16a7e6df57d0f6d67e42ce026e5d5930b;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [POWERPC] mpc5200-fec: Fix possible NULL dereference in mdio driver 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 Signed-off-by: Paul Mackerras --- diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index 1837584c4504..6a3ac4ea97e9 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c @@ -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; } }