mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.11 01/16] soc: qcom: Add check devm_kasprintf() returned value
@ 2024-11-12 10:35 Sasha Levin
  2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 02/16] firmware: arm_scmi: Reject clear channel request on A2P Sasha Levin
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Sasha Levin @ 2024-11-12 10:35 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Charles Han, Bjorn Andersson, Sasha Levin, konradybcio, linux-arm-msm

From: Charles Han <hanchunchao@inspur.com>

[ Upstream commit e694d2b5c58ba2d1e995d068707c8d966e7f5f2a ]

devm_kasprintf() can return a NULL pointer on failure but this
returned value in qcom_socinfo_probe() is not checked.

Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://lore.kernel.org/r/20240929072349.202520-1-hanchunchao@inspur.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/soc/qcom/socinfo.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index d7359a235e3cf..1d5a69eda26e5 100644
--- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c
@@ -782,10 +782,16 @@ static int qcom_socinfo_probe(struct platform_device *pdev)
 	qs->attr.revision = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%u.%u",
 					   SOCINFO_MAJOR(le32_to_cpu(info->ver)),
 					   SOCINFO_MINOR(le32_to_cpu(info->ver)));
-	if (offsetof(struct socinfo, serial_num) <= item_size)
+	if (!qs->attr.soc_id || qs->attr.revision)
+		return -ENOMEM;
+
+	if (offsetof(struct socinfo, serial_num) <= item_size) {
 		qs->attr.serial_number = devm_kasprintf(&pdev->dev, GFP_KERNEL,
 							"%u",
 							le32_to_cpu(info->serial_num));
+		if (!qs->attr.serial_number)
+			return -ENOMEM;
+	}
 
 	qs->soc_dev = soc_device_register(&qs->attr);
 	if (IS_ERR(qs->soc_dev))
-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-11-12 10:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-12 10:35 [PATCH AUTOSEL 6.11 01/16] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 02/16] firmware: arm_scmi: Reject clear channel request on A2P Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 03/16] regulator: rk808: Add apply_bit for BUCK3 on RK809 Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 04/16] platform/x86: dell-smbios-base: Extends support to Alienware products Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 05/16] platform/x86: dell-wmi-base: Handle META key Lock/Unlock events Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 06/16] platform/x86: ideapad-laptop: add missing Ideapad Pro 5 fn keys Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 07/16] ASoC: tas2781: Add new driver version for tas2563 & tas2781 qfn chip Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 08/16] tools/lib/thermal: Remove the thermal.h soft link when doing make clean Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 09/16] can: j1939: fix error in J1939 documentation Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 10/16] platform/x86: thinkpad_acpi: Fix for ThinkPad's with ECFW showing incorrect fan speed Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 11/16] ASoC: amd: yc: fix internal mic on Xiaomi Book Pro 14 2022 Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 12/16] ASoC: amd: yc: Support dmic on another model of Lenovo Thinkpad E14 Gen 6 Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 13/16] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 14/16] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 15/16] drm: panel-orientation-quirks: Make Lenovo Yoga Tab 3 X90F DMI match less strict Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 16/16] proc/softirqs: replace seq_printf with seq_put_decimal_ull_width Sasha Levin

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®