backlight: pm8941: Add NULL check in exynos_generic_icc_probe()
Subsystems (3)
PATCH v2 1/1 backlight: pm8941: Add NULL check in exynos_generic_icc_probe()
devm_kasprintf() returns NULL when memory allocation fails. Currently, exynos_generic_icc_probe() does not check for this case, which results in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
---
V1 -> V2: The fix ensures icc_node cleanup on devm_kasprintf() failure without restructuring the proven error handling workflow.
drivers/interconnect/samsung/exynos.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/interconnect/samsung/exynos.c +4 -0
@@ -134,6 +134,10 @@ static int exynos_generic_icc_probe(struct platform_device *pdev) priv->node = icc_node; icc_node->name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%pOFn" , bus_dev->of_node); +if (!icc_node->name) { + ret = -ENOMEM ; + goto err_node_del; + }if (of_property_read_u32 (bus_dev->of_node,"samsung,data-clock-ratio" , &priv->bus_clk_ratio)) priv->bus_clk_ratio =EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO ;
Signature · 1 line
2.34.1
Quoted 9 lines · Henry Martin
devm_kasprintf()returns NULL when memory allocation fails. Currently,exynos_generic_icc_probe()does not check for this case, which results in a NULL pointer dereference.Add NULL check after
devm_kasprintf()to prevent this issue.Fixes 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs")Signed-off-by Henry Martin <[email protected]>---
Best regards,
Krzysztof
Hi Krzysztof,
Just a friendly reminder about the patch below which received your Reviewed-by tag but hasn't been applied yet. Could you let me know if there are any further actions needed?
Quoted 16 lines · Krzysztof Kozlowski <[email protected]> 于2025年4月1日周二 19:00写道:
Quoted 9 lines · Henry Martin
devm_kasprintf()returns NULL when memory allocation fails. Currently,exynos_generic_icc_probe()does not check for this case, which results in a NULL pointer dereference.Add NULL check after
devm_kasprintf()to prevent this issue.Fixes 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs")Signed-off-by Henry Martin <[email protected]>---
Reviewed-by Krzysztof Kozlowski <[email protected]>Best regards,
Krzysztof