lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250331091245.6668-1-bsdhenrymartin@gmail.com>
Date: Mon, 31 Mar 2025 17:12:45 +0800
From: Henry Martin <bsdhenrymartin@...il.com>
To: lee@...nel.org,
	danielt@...nel.org,
	jingoohan1@...il.com,
	deller@....de
Cc: linux-arm-msm@...r.kernel.org,
	dri-devel@...ts.freedesktop.org,
	linux-fbdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Henry Martin <bsdhenrymartin@...il.com>
Subject: [PATCH] backlight: qcom-wled: Add NULL check in the wled_configure

When devm_kasprintf() fails, it returns a NULL pointer. However, this return value is not properly checked in the function wled_configure.

A NULL check should be added after the devm_kasprintf call to prevent potential NULL pointer dereference error.

Fixes: f86b77583d88c ("backlight: pm8941: Convert to using %pOFn instead of device_node.name")

Signed-off-by: Henry Martin <bsdhenrymartin@...il.com>
---
 drivers/video/backlight/qcom-wled.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index 9afe701b2a1b..db5eda8ec37e 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1406,8 +1406,14 @@ static int wled_configure(struct wled *wled)
 	wled->ctrl_addr = be32_to_cpu(*prop_addr);
 
 	rc = of_property_read_string(dev->of_node, "label", &wled->name);
-	if (rc)
+	if (rc) {
 		wled->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node);
+		if (!wled->name) {
+			dev_err(dev, "Failed to allocate memory for wled name\n");
+			return -ENOMEM;
+		}
+	}
+
 
 	switch (wled->version) {
 	case 3:
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ