1
0
Fork 0
alistair23-linux/drivers/net/ethernet/xilinx
Zhang Changzhong 5ae78c6926 net: ll_temac: Fix potential NULL dereference in temac_probe()
[ Upstream commit cc6596fc72 ]

platform_get_resource() may fail and in this case a NULL dereference
will occur.

Fix it to use devm_platform_ioremap_resource() instead of calling
platform_get_resource() and devm_ioremap().

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = \(platform_get_resource\|platform_get_resource_byname\)(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);

Fixes: 8425c41d1e ("net: ll_temac: Extend support to non-device-tree platforms")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Acked-by: Esben Haabendal <esben@geanix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-21 13:27:05 +01:00
..
Kconfig net: axienet: convert to phylink API 2019-06-06 16:24:30 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ll_temac.h net: ll_temac: Handle DMA halt condition caused by buffer underrun 2020-03-21 08:11:51 +01:00
ll_temac_main.c net: ll_temac: Fix potential NULL dereference in temac_probe() 2020-12-21 13:27:05 +01:00
ll_temac_mdio.c net: ll_temac: Prepare indirect register access for multicast support 2019-05-23 09:33:57 -07:00
xilinx_axienet.h net: axienet: Convert DMA error handler to a work queue 2020-10-01 13:17:46 +02:00
xilinx_axienet_main.c net: axienet: Propagate failure of DMA descriptor setup 2020-10-01 13:17:47 +02:00
xilinx_axienet_mdio.c net: axienet: Fix MDIO bus parent node detection 2019-06-06 16:24:30 -07:00
xilinx_emaclite.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00