Skip to contentSkip to conversation

soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()

PATCH Applied Chenyuan Yang 3 participants 3 messages Feb 12, 2025 – Feb 15, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()

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.

---
 drivers/soc/samsung/exynos-chipid.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/soc/samsung/exynos-chipid.c +2 -0
index e37dde1fb588..95294462ff21 100644
@@ -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");
Signature · 1 line
2.34.1
#1 lore raw
Quoted 5 lines · 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").

That's not really relevant. Drop.

Quoted 3 lines

This issue is found by our static analysis tool.

Missing Fixes tag and Cc-stable.

Best regards,
Krzysztof

#2 lore raw
In reply to Chenyuan Yang
Quoted 8 lines · 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.

[...]

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,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>