Commit 92ee77d1 authored by Kangjie Lu's avatar Kangjie Lu Committed by David S. Miller

net: marvell: fix a missing check of acpi_match_device

When acpi_match_device fails, its return value is NULL. Directly using
the return value without a check may result in a NULL-pointer
dereference. The fix checks if acpi_match_device fails, and if so,
returns -EINVAL.
Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46273cf7
...@@ -5255,6 +5255,8 @@ static int mvpp2_probe(struct platform_device *pdev) ...@@ -5255,6 +5255,8 @@ static int mvpp2_probe(struct platform_device *pdev)
if (has_acpi_companion(&pdev->dev)) { if (has_acpi_companion(&pdev->dev)) {
acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table, acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
&pdev->dev); &pdev->dev);
if (!acpi_id)
return -EINVAL;
priv->hw_version = (unsigned long)acpi_id->driver_data; priv->hw_version = (unsigned long)acpi_id->driver_data;
} else { } else {
priv->hw_version = priv->hw_version =
......
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