diff options
| author | Chenyuan Yang <chenyuan0y@gmail.com> | 2025-02-12 15:35:18 -0600 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-25 10:45:27 +0200 |
| commit | 5f80fd2ff8bfd13e41554741740e0ca8e6445ded (patch) | |
| tree | 717827836309ee2edf42d0a27b1490e92ec22999 /drivers/soc | |
| parent | 1404dff1e11bf927b70ac25e1de97bed9742ede4 (diff) | |
| download | linux-5f80fd2ff8bfd13e41554741740e0ca8e6445ded.tar.gz linux-5f80fd2ff8bfd13e41554741740e0ca8e6445ded.tar.bz2 linux-5f80fd2ff8bfd13e41554741740e0ca8e6445ded.zip | |
soc: samsung: exynos-chipid: Add NULL pointer check in exynos_chipid_probe()
commit c8222ef6cf29dd7cad21643228f96535cc02b327 upstream.
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>
Link: https://lore.kernel.org/r/20250212213518.69432-1-chenyuan0y@gmail.com
Fixes: 3253b7b7cd44 ("soc: samsung: Add exynos chipid driver support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/soc')
| -rw-r--r-- | drivers/soc/samsung/exynos-chipid.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 7ba45c4aff97..1307f6d61c98 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -130,6 +130,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"); |
