projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
594c61f
)
net: mvpp2: fix possible invalid pointer dereference
author
Hui Tang
<tanghui20@huawei.com>
Thu, 17 Nov 2022 08:40:32 +0000
(16:40 +0800)
committer
Jakub Kicinski
<kuba@kernel.org>
Sat, 19 Nov 2022 03:38:59 +0000
(19:38 -0800)
It will cause invalid pointer dereference to priv->cm3_base behind,
if PTR_ERR(priv->cm3_base) in mvpp2_get_sram().
Fixes: e54ad1e01c00 ("net: mvpp2: add CM3 SRAM memory map")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
Link:
https://lore.kernel.org/r/20221117084032.101144-1-tanghui20@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
patch
|
blob
|
history
diff --git
a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index eb0fb812809680015575a19c8bd265f6224d7a15..b399bdb1ca3620b9a2321cff14d0bf211d03d7a1 100644
(file)
--- a/
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@
-7350,6
+7350,7
@@
static int mvpp2_get_sram(struct platform_device *pdev,
struct mvpp2 *priv)
{
struct resource *res;
+ void __iomem *base;
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
if (!res) {
@@
-7360,9
+7361,12
@@
static int mvpp2_get_sram(struct platform_device *pdev,
return 0;
}
- priv->cm3_base = devm_ioremap_resource(&pdev->dev, res);
+ base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
- return PTR_ERR_OR_ZERO(priv->cm3_base);
+ priv->cm3_base = base;
+ return 0;
}
static int mvpp2_probe(struct platform_device *pdev)