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: <20250426062305.work.819-kees@kernel.org>
Date: Fri, 25 Apr 2025 23:23:06 -0700
From: Kees Cook <kees@...nel.org>
To: Helge Deller <deller@....de>
Cc: Kees Cook <kees@...nel.org>,
	Javier Martinez Canillas <javierm@...hat.com>,
	Thomas Zimmermann <tzimmermann@...e.de>,
	Zheyu Ma <zheyuma97@...il.com>,
	Samuel Thibault <samuel.thibault@...-lyon.org>,
	Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
	linux-fbdev@...r.kernel.org,
	dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org,
	linux-hardening@...r.kernel.org
Subject: [PATCH] video: fbdev: arkfb: Cast ics5342_init() allocation type

In preparation for making the kmalloc family of allocators type aware,
we need to make sure that the returned type from the allocation matches
the type of the variable being assigned. (Before, the allocator would
always return "void *", which can be implicitly cast to any pointer type.)

The assigned type is "struct dac_info *" but the returned type will be
"struct ics5342_info *", which has a larger allocation size. This is
by design, as struct ics5342_info contains struct dac_info as its first
member. Cast the allocation type to match the assignment.

Signed-off-by: Kees Cook <kees@...nel.org>
---
Cc: Helge Deller <deller@....de>
Cc: Javier Martinez Canillas <javierm@...hat.com>
Cc: Thomas Zimmermann <tzimmermann@...e.de>
Cc: Zheyu Ma <zheyuma97@...il.com>
Cc: Samuel Thibault <samuel.thibault@...-lyon.org>
Cc: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
Cc: <linux-fbdev@...r.kernel.org>
Cc: <dri-devel@...ts.freedesktop.org>
---
 drivers/video/fbdev/arkfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c
index 082501feceb9..7d131e3d159a 100644
--- a/drivers/video/fbdev/arkfb.c
+++ b/drivers/video/fbdev/arkfb.c
@@ -431,7 +431,7 @@ static struct dac_ops ics5342_ops = {
 
 static struct dac_info * ics5342_init(dac_read_regs_t drr, dac_write_regs_t dwr, void *data)
 {
-	struct dac_info *info = kzalloc(sizeof(struct ics5342_info), GFP_KERNEL);
+	struct dac_info *info = (struct dac_info *)kzalloc(sizeof(struct ics5342_info), GFP_KERNEL);
 
 	if (! info)
 		return NULL;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ