Skip to content

Commit

Permalink
net: WIZnet drivers: fix possible NULL dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Sinkovsky authored and David S. Miller committed Apr 13, 2012
1 parent 9b17876 commit 77577bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/wiznet/w5100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/wiznet/w5300.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 77577bf

Please sign in to comment.