* [PATCH] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
@ 2025-02-12 21:35 Chenyuan Yang
2025-02-13 7:32 ` Krzysztof Kozlowski
2025-02-15 13:42 ` Krzysztof Kozlowski
0 siblings, 2 replies; 3+ messages in thread
From: Chenyuan Yang @ 2025-02-12 21:35 UTC (permalink / raw)
To: krzk, alim.akhtar, richardcochran
Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, netdev, Chenyuan Yang
soc_dev_attr->revision could be NULL, thus,
a pointer check is added to prevent potential NULL pointer dereference.
This is similar to the fix in commit 3027e7b15b02
("ice: Fix some null pointer dereference issues in ice_ptp.c").
This issue is found by our static analysis tool.
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
---
drivers/soc/samsung/exynos-chipid.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index e37dde1fb588..95294462ff21 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -134,6 +134,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
soc_dev_attr->revision = devm_kasprintf(&pdev->dev, GFP_KERNEL,
"%x", soc_info.revision);
+ if (!soc_dev_attr->revision)
+ return -ENOMEM;
soc_dev_attr->soc_id = product_id_to_soc_id(soc_info.product_id);
if (!soc_dev_attr->soc_id) {
pr_err("Unknown SoC\n");
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
2025-02-12 21:35 [PATCH] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe() Chenyuan Yang
@ 2025-02-13 7:32 ` Krzysztof Kozlowski
2025-02-15 13:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-13 7:32 UTC (permalink / raw)
To: Chenyuan Yang, alim.akhtar, richardcochran
Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, netdev
On 12/02/2025 22:35, Chenyuan Yang wrote:
> soc_dev_attr->revision could be NULL, thus,
> a pointer check is added to prevent potential NULL pointer dereference.
> This is similar to the fix in commit 3027e7b15b02
> ("ice: Fix some null pointer dereference issues in ice_ptp.c").
That's not really relevant. Drop.
>
> This issue is found by our static analysis tool.
>
Missing Fixes tag and Cc-stable.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
2025-02-12 21:35 [PATCH] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe() Chenyuan Yang
2025-02-13 7:32 ` Krzysztof Kozlowski
@ 2025-02-15 13:42 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-15 13:42 UTC (permalink / raw)
To: krzk, alim.akhtar, richardcochran, Chenyuan Yang
Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, netdev
On Wed, 12 Feb 2025 15:35:18 -0600, Chenyuan Yang wrote:
> soc_dev_attr->revision could be NULL, thus,
> a pointer check is added to prevent potential NULL pointer dereference.
> This is similar to the fix in commit 3027e7b15b02
> ("ice: Fix some null pointer dereference issues in ice_ptp.c").
>
> This issue is found by our static analysis tool.
>
> [...]
Applied, thanks!
[1/1] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
https://git.kernel.org/krzk/linux/c/c8222ef6cf29dd7cad21643228f96535cc02b327
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-15 13:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-12 21:35 [PATCH] soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe() Chenyuan Yang
2025-02-13 7:32 ` Krzysztof Kozlowski
2025-02-15 13:42 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®