1
0
Fork 0

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: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
Kangjie Lu 2018-12-26 00:31:08 -06:00 committed by David S. Miller
parent 46273cf7e0
commit 92ee77d148
1 changed files with 2 additions and 0 deletions

View File

@ -5255,6 +5255,8 @@ static int mvpp2_probe(struct platform_device *pdev)
if (has_acpi_companion(&pdev->dev)) {
acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
&pdev->dev);
if (!acpi_id)
return -EINVAL;
priv->hw_version = (unsigned long)acpi_id->driver_data;
} else {
priv->hw_version =