projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d6e9e8e
)
phy: Sparx5 Eth SerDes: check return value after calling platform_get_resource()
author
Yang Yingliang
<yangyingliang@huawei.com>
Thu, 3 Jun 2021 05:10:14 +0000
(13:10 +0800)
committer
Vinod Koul
<vkoul@kernel.org>
Thu, 3 Jun 2021 05:48:19 +0000
(11:18 +0530)
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>
Link:
https://lore.kernel.org/r/20210603051014.2674744-1-yangyingliang@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/microchip/sparx5_serdes.c
patch
|
blob
|
history
diff --git
a/drivers/phy/microchip/sparx5_serdes.c
b/drivers/phy/microchip/sparx5_serdes.c
index c8a7d0927ced10d26ef906c9ee95048117cd4a61..4076580fc2cd974c04e231ad7ae8d17c87206221 100644
(file)
--- a/
drivers/phy/microchip/sparx5_serdes.c
+++ b/
drivers/phy/microchip/sparx5_serdes.c
@@
-2470,6
+2470,10
@@
static int sparx5_serdes_probe(struct platform_device *pdev)
priv->coreclock = clock;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores) {
+ dev_err(priv->dev, "Invalid resource\n");
+ return -EINVAL;
+ }
iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores));
if (IS_ERR(iomem)) {
dev_err(priv->dev, "Unable to get serdes registers: %s\n",