mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-17 20:54:10 +00:00
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: 60a3647600
("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8343b1f8b9
commit
d27f0201b9
1 changed files with 3 additions and 0 deletions
|
@ -147,6 +147,9 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev)
|
|||
int i;
|
||||
|
||||
ksz8 = devm_kzalloc(&mdiodev->dev, sizeof(struct ksz8), GFP_KERNEL);
|
||||
if (!ksz8)
|
||||
return -ENOMEM;
|
||||
|
||||
ksz8->priv = mdiodev;
|
||||
|
||||
dev = ksz_switch_alloc(&mdiodev->dev, ksz8);
|
||||
|
|
Loading…
Add table
Reference in a new issue