projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0bb51a3
)
net: micrel: check return value after calling platform_get_resource()
author
Yang Yingliang
<yangyingliang@huawei.com>
Mon, 7 Jun 2021 14:55:21 +0000
(22:55 +0800)
committer
David S. Miller
<davem@davemloft.net>
Mon, 7 Jun 2021 21:07:22 +0000
(14:07 -0700)
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/micrel/ks8842.c
patch
|
blob
|
history
diff --git
a/drivers/net/ethernet/micrel/ks8842.c
b/drivers/net/ethernet/micrel/ks8842.c
index
caa251d
..
b277139
100644
(file)
--- a/
drivers/net/ethernet/micrel/ks8842.c
+++ b/
drivers/net/ethernet/micrel/ks8842.c
@@
-1135,6
+1135,10
@@
static int ks8842_probe(struct platform_device *pdev)
unsigned i;
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iomem) {
+ dev_err(&pdev->dev, "Invalid resource\n");
+ return -EINVAL;
+ }
if (!request_mem_region(iomem->start, resource_size(iomem), DRV_NAME))
goto err_mem_region;