net: axienet: Fix devm_ioremap_resource return value check
Value returned by devm_ioremap_resource() was checked for non-NULL but
devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
error this could lead to dereference of ERR_PTR.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Cc: <stable@vger.kernel.org>
Fixes: 46aa27df88
("net: axienet: Use devm_* calls")
Reviewed-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
fc5778ca3f
Коммит
fcc028c106
|
@ -1530,9 +1530,9 @@ static int axienet_probe(struct platform_device *pdev)
|
|||
/* Map device registers */
|
||||
ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
lp->regs = devm_ioremap_resource(&pdev->dev, ethres);
|
||||
if (!lp->regs) {
|
||||
if (IS_ERR(lp->regs)) {
|
||||
dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n");
|
||||
ret = -ENOMEM;
|
||||
ret = PTR_ERR(lp->regs);
|
||||
goto free_netdev;
|
||||
}
|
||||
|
||||
|
@ -1599,9 +1599,9 @@ static int axienet_probe(struct platform_device *pdev)
|
|||
goto free_netdev;
|
||||
}
|
||||
lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares);
|
||||
if (!lp->dma_regs) {
|
||||
if (IS_ERR(lp->dma_regs)) {
|
||||
dev_err(&pdev->dev, "could not map DMA regs\n");
|
||||
ret = -ENOMEM;
|
||||
ret = PTR_ERR(lp->dma_regs);
|
||||
goto free_netdev;
|
||||
}
|
||||
lp->rx_irq = irq_of_parse_and_map(np, 1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче