diff options
author | Kangjie Lu <kjlu@umn.edu> | 2018-12-26 00:31:08 -0600 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-27 16:26:55 -0800 |
commit | 92ee77d148bf06d8c52664be4d1b862583fd5c0e (patch) | |
tree | 1ce96be8770583d1dfd5201552733ea6493654fc /drivers/net/ethernet/marvell/mvpp2 | |
parent | 46273cf7e009231d2b6bc10a926e82b8928a9fb2 (diff) | |
download | linux-92ee77d148bf06d8c52664be4d1b862583fd5c0e.tar.bz2 |
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>
Diffstat (limited to 'drivers/net/ethernet/marvell/mvpp2')
-rw-r--r-- | drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index f1dab0b55769..c9444346475b 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -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 = |