mirror of https://gitee.com/openkylin/linux.git
net: WIZnet drivers: fix possible NULL dereference
This fixes possible null dereference in probe() function: when both .mac_addr and .link_gpio are unknown, dev.platform_data may be NULL Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mike Sinkovsky <msink@permonline.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9b17876f3e
commit
77577bf932
|
@ -682,7 +682,7 @@ static int __devinit w5100_hw_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
priv->irq = irq;
|
||||
|
||||
priv->link_gpio = data->link_gpio;
|
||||
priv->link_gpio = data ? data->link_gpio : -EINVAL;
|
||||
if (gpio_is_valid(priv->link_gpio)) {
|
||||
char *link_name = devm_kzalloc(&pdev->dev, 16, GFP_KERNEL);
|
||||
if (!link_name)
|
||||
|
|
|
@ -594,7 +594,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
priv->irq = irq;
|
||||
|
||||
priv->link_gpio = data->link_gpio;
|
||||
priv->link_gpio = data ? data->link_gpio : -EINVAL;
|
||||
if (gpio_is_valid(priv->link_gpio)) {
|
||||
char *link_name = devm_kzalloc(&pdev->dev, 16, GFP_KERNEL);
|
||||
if (!link_name)
|
||||
|
|
Loading…
Reference in New Issue