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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231009165741.746184-3-max.kellermann@ionos.com>
Date:   Mon,  9 Oct 2023 18:57:36 +0200
From:   Max Kellermann <max.kellermann@...os.com>
To:     MyungJoo Ham <myungjoo.ham@...sung.com>,
        Chanwoo Choi <cw00.choi@...sung.com>
Cc:     Max Kellermann <max.kellermann@...os.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 3/7] drivers/extcon: add local variable for newly allocated attribute_group**

This allows the compiler to keep the pointer in a register and
prepares for making the struct field "const".

Signed-off-by: Max Kellermann <max.kellermann@...os.com>
---
 drivers/extcon/extcon.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 6f7a60d2ed91..e879690d4fef 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1202,6 +1202,7 @@ static int extcon_alloc_muex(struct extcon_dev *edev)
  */
 static int extcon_alloc_groups(struct extcon_dev *edev)
 {
+	const struct attribute_group **groups;
 	int index;
 
 	if (!edev)
@@ -1210,20 +1211,20 @@ static int extcon_alloc_groups(struct extcon_dev *edev)
 	if (!edev->max_supported)
 		return 0;
 
-	edev->extcon_dev_type.groups = kcalloc(edev->max_supported + 2,
-					  sizeof(*edev->extcon_dev_type.groups),
+	edev->extcon_dev_type.groups = groups = kcalloc(edev->max_supported + 2,
+					  sizeof(*groups),
 					  GFP_KERNEL);
-	if (!edev->extcon_dev_type.groups)
+	if (!groups)
 		return -ENOMEM;
 
 	edev->extcon_dev_type.name = dev_name(&edev->dev);
 	edev->extcon_dev_type.release = dummy_sysfs_dev_release;
 
 	for (index = 0; index < edev->max_supported; index++)
-		edev->extcon_dev_type.groups[index] = &edev->cables[index].attr_g;
+		groups[index] = &edev->cables[index].attr_g;
 
 	if (edev->mutually_exclusive)
-		edev->extcon_dev_type.groups[index] = &edev->attr_g_muex;
+		groups[index] = &edev->attr_g_muex;
 
 	edev->dev.type = &edev->extcon_dev_type;
 
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ