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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <92a354a86ceb572c4fde35047177c5681d83f81f.1714399603.git.mirq-linux@rere.qmqm.pl>
Date: Mon, 29 Apr 2024 16:45:30 +0200
From:	Michał Mirosław <mirq-linux@...e.qmqm.pl>
To:	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH v2 08/12] regulator/core: set_consumer_device_supply: avoid
 copying const data

As consumer_dev_name might as well be const, don't copy it if not
required.

Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
 drivers/regulator/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index efb68a5c85af..431e1c164b11 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1747,7 +1747,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
 	new_node->supply = supply;
 
 	if (consumer_dev_name != NULL) {
-		new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL);
+		new_node->dev_name = kstrdup_const(consumer_dev_name, GFP_KERNEL);
 		if (new_node->dev_name == NULL) {
 			kfree(new_node);
 			return -ENOMEM;
@@ -1782,7 +1782,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev,
 
 fail:
 	mutex_unlock(&regulator_list_mutex);
-	kfree(new_node->dev_name);
+	kfree_const(new_node->dev_name);
 	kfree(new_node);
 	return -EBUSY;
 }
@@ -1794,7 +1794,7 @@ static void unset_regulator_supplies(struct regulator_dev *rdev)
 	list_for_each_entry_safe(node, n, &regulator_map_list, list) {
 		if (rdev == node->regulator) {
 			list_del(&node->list);
-			kfree(node->dev_name);
+			kfree_const(node->dev_name);
 			kfree(node);
 		}
 	}
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ