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: <1719496036-24642-1-git-send-email-quic_zijuhu@quicinc.com>
Date: Thu, 27 Jun 2024 21:47:16 +0800
From: Zijun Hu <quic_zijuhu@...cinc.com>
To: <gregkh@...uxfoundation.org>, <rafael@...nel.org>
CC: <linux-kernel@...r.kernel.org>, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH] devres: Simple code optimization

Initialize an uninitialized struct member for devres_open_group()
and simplify devm_percpu_match() implementation.

Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
This change is intend to replace below one:
https://lore.kernel.org/lkml/1718629765-32720-1-git-send-email-quic_zijuhu@quicinc.com/#t

 drivers/base/devres.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 3df0025d12aa..5b1d498e83ab 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -567,6 +567,7 @@ void * devres_open_group(struct device *dev, void *id, gfp_t gfp)
 	grp->id = grp;
 	if (id)
 		grp->id = id;
+	grp->color = 0;
 
 	spin_lock_irqsave(&dev->devres_lock, flags);
 	add_dr(dev, &grp->node[0]);
@@ -1172,9 +1173,9 @@ static void devm_percpu_release(struct device *dev, void *pdata)
 
 static int devm_percpu_match(struct device *dev, void *data, void *p)
 {
-	struct devres *devr = container_of(data, struct devres, data);
+	void __percpu *ptr = *(void __percpu **)data;
 
-	return *(void **)devr->data == p;
+	return ptr == (void __percpu *)p;
 }
 
 /**
-- 
2.7.4


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ