Skip to content

Commit a39ff4a

Browse files
Yang Yingliangdavem330
authored andcommitted
net: w5100: check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 464a572 commit a39ff4a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/wiznet/w5100.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,8 @@ static int w5100_mmio_probe(struct platform_device *pdev)
10471047
mac_addr = data->mac_addr;
10481048

10491049
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1050+
if (!mem)
1051+
return -EINVAL;
10501052
if (resource_size(mem) < W5100_BUS_DIRECT_SIZE)
10511053
ops = &w5100_mmio_indirect_ops;
10521054
else

0 commit comments

Comments
 (0)