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: <1718629765-32720-1-git-send-email-quic_zijuhu@quicinc.com>
Date: Mon, 17 Jun 2024 21:09:25 +0800
From: Zijun Hu <quic_zijuhu@...cinc.com>
To: <gregkh@...uxfoundation.org>
CC: <rafael@...nel.org>, <linux-kernel@...r.kernel.org>,
        Zijun Hu
	<quic_zijuhu@...cinc.com>
Subject: [PATCH v1] devres: Initialize a uninitialized struct member

Use memset() after kmalloc() a struct devres_group to initialize
potential uninitialized members such as @color within kernel API
devres_open_group() as alloc_dr() does.

Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
 drivers/base/devres.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 3df0025d12aa..ba3e4603cd77 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -558,6 +558,10 @@ void * devres_open_group(struct device *dev, void *id, gfp_t gfp)
 	if (unlikely(!grp))
 		return NULL;
 
+	/* No need to clear memory twice */
+	if (!(gfp & __GFP_ZERO))
+		memset(grp, 0, sizeof(*grp));
+
 	grp->node[0].release = &group_open_release;
 	grp->node[1].release = &group_close_release;
 	INIT_LIST_HEAD(&grp->node[0].entry);
-- 
2.7.4


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ