Message ID | 20250220081714.2676828-1-haoxiang_li2024@163.com (mailing list archive) |
---|---|
State | Accepted |
Commit | e31e3f6c0ce473f7ce1e70d54ac8e3ed190509f8 |
Headers | show |
Series | [v2] soc: loongson: loongson2_guts: Add check for devm_kstrdup() | expand |
Hello: This patch was applied to soc/soc.git (arm/fixes) by Arnd Bergmann <arnd@arndb.de>: On Thu, 20 Feb 2025 16:17:14 +0800 you wrote: > Add check for the return value of devm_kstrdup() in > loongson2_guts_probe() to catch potential exception. > > Fixes: b82621ac8450 ("soc: loongson: add GUTS driver for loongson-2 platforms") > Cc: stable@vger.kernel.org > Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> > > [...] Here is the summary with links: - [v2] soc: loongson: loongson2_guts: Add check for devm_kstrdup() https://git.kernel.org/soc/soc/c/e31e3f6c0ce4 You are awesome, thank you!
diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c index ae42e3a9127f..16913c3ef65c 100644 --- a/drivers/soc/loongson/loongson2_guts.c +++ b/drivers/soc/loongson/loongson2_guts.c @@ -114,8 +114,11 @@ static int loongson2_guts_probe(struct platform_device *pdev) if (of_property_read_string(root, "model", &machine)) of_property_read_string_index(root, "compatible", 0, &machine); of_node_put(root); - if (machine) + if (machine) { soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL); + if (!soc_dev_attr.machine) + return -ENOMEM; + } svr = loongson2_guts_get_svr(); soc_die = loongson2_soc_die_match(svr, loongson2_soc_die);
Add check for the return value of devm_kstrdup() in loongson2_guts_probe() to catch potential exception. Fixes: b82621ac8450 ("soc: loongson: add GUTS driver for loongson-2 platforms") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> --- Changes in v2: - modify the check position. Thanks, Binbin! - modify the title description. --- drivers/soc/loongson/loongson2_guts.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)