Message ID | 20240314192950.27343-2-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Add RPC-IF support for RZ/G2{EHMN} | expand |
Hi! > From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > > commit 59e27d7c94aa02da039b000d33c304c179395801 upstream. > > The platform_get_resource_byname() can return NULL which would be > immediately dereferenced by resource_size(). Instead dereference it > after validating the resource. This claims to fix a bug, but it really does not. 4/9 adds a return and that fixes the bug. I guess there's nothing that can or should be done about it at this point. Best regards, Pavel > +++ b/drivers/memory/renesas-rpc-if.c > @@ -192,10 +192,10 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev) > } > > res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap"); > - rpc->size = resource_size(res); > rpc->dirmap = devm_ioremap_resource(&pdev->dev, res); > if (IS_ERR(rpc->dirmap)) > rpc->dirmap = NULL; > + rpc->size = resource_size(res); > > rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); > if (IS_ERR(rpc->rstc))
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c index 5f650eb3e9e7..15bed5be96e3 100644 --- a/drivers/memory/renesas-rpc-if.c +++ b/drivers/memory/renesas-rpc-if.c @@ -192,10 +192,10 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev) } res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap"); - rpc->size = resource_size(res); rpc->dirmap = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(rpc->dirmap)) rpc->dirmap = NULL; + rpc->size = resource_size(res); rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(rpc->rstc))