Commit d27f0201 authored by Oleksij Rempel's avatar Oleksij Rempel Committed by David S. Miller

net: dsa: ksz: ksz8863_smi_probe: fix possible NULL pointer dereference

Fix possible NULL pointer dereference in case devm_kzalloc() failed to
allocate memory.

Fixes: 60a36476 ("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support")
Reported-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8343b1f8
...@@ -147,6 +147,9 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev) ...@@ -147,6 +147,9 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev)
int i; int i;
ksz8 = devm_kzalloc(&mdiodev->dev, sizeof(struct ksz8), GFP_KERNEL); ksz8 = devm_kzalloc(&mdiodev->dev, sizeof(struct ksz8), GFP_KERNEL);
if (!ksz8)
return -ENOMEM;
ksz8->priv = mdiodev; ksz8->priv = mdiodev;
dev = ksz_switch_alloc(&mdiodev->dev, ksz8); dev = ksz_switch_alloc(&mdiodev->dev, ksz8);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment