提交 efe21fee 编写于 作者: K Kangjie Lu 提交者: Xie XiuQi

net: marvell: fix a missing check of acpi_match_device

[ Upstream commit 92ee77d148bf06d8c52664be4d1b862583fd5c0e ]

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: NKangjie Lu <kjlu@umn.edu>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 ce336eb1
...@@ -5132,6 +5132,8 @@ static int mvpp2_probe(struct platform_device *pdev) ...@@ -5132,6 +5132,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册