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: <20240117073124.143636-1-chentao@kylinos.cn>
Date: Wed, 17 Jan 2024 15:31:24 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: dmitry.torokhov@...il.com,
	aduggan@...aptics.com,
	cheiny@...aptics.com
Cc: linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH v2] Input: synaptics-rmi4: Add a null pointer check to the rmi_driver_probe

devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.

Signed-off-by: Kunwu Chan <chentao@...inos.cn>
Suggested-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
---
v2: Change title and remove dev_err
---
 drivers/input/rmi4/rmi_driver.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 258d5fe3d395..8da104e99e7b 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -1197,6 +1197,10 @@ static int rmi_driver_probe(struct device *dev)
 		rmi_driver_set_input_params(rmi_dev, data->input);
 		data->input->phys = devm_kasprintf(dev, GFP_KERNEL,
 						"%s/input0", dev_name(dev));
+		if (!data->input->phys) {
+			retval = -ENOMEM;
+			goto err;
+		}
 	}
 
 	retval = rmi_init_functions(data);
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ