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]
Date:   Thu, 10 Mar 2022 13:02:38 +0800
From:   Guo Zhengkui <guozhengkui@...o.com>
To:     Hector Martin <marcan@...can.st>, Sven Peter <sven@...npeter.dev>,
        Alyssa Rosenzweig <alyssa@...enzweig.io>,
        Thomas Gleixner <tglx@...utronix.de>,
        Marc Zyngier <maz@...nel.org>,
        linux-arm-kernel@...ts.infradead.org (moderated list:ARM/APPLE MACHINE
        SUPPORT), linux-kernel@...r.kernel.org (open list:IRQCHIP DRIVERS)
Cc:     zhengkui_guo@...look.com, Guo Zhengkui <guozhengkui@...o.com>
Subject: [PATCH] irqchip/apple-aic: application of sizeof() to a pointer

`ic->fiq_aff[fiq]` is a pointer to the unnamed struct.
`sizeof(ic->fiq_aff[fiq])` intends to get the size of this pointer. But
readers may get confused. `sizeof(unsigned long)` makes more sense because
`unsigned long` has the same size of pointer.

reference:
https://lore.kernel.org/all/Ya%2FeUbdN1+ABFVWf@rowland.harvard.edu/
https://lore.kernel.org/all/YbBGGI9wQenI4kP7@kroah.com/
https://lore.kernel.org/all/20211209062441.9856-1-guozhengkui@vivo.com/

Signed-off-by: Guo Zhengkui <guozhengkui@...o.com>
---
 drivers/irqchip/irq-apple-aic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c
index b40199c6625e..23098b469b1a 100644
--- a/drivers/irqchip/irq-apple-aic.c
+++ b/drivers/irqchip/irq-apple-aic.c
@@ -810,7 +810,7 @@ static void build_fiq_affinity(struct aic_irq_chip *ic, struct device_node *aff)
 	if (WARN_ON(n < 0))
 		return;
 
-	ic->fiq_aff[fiq] = kzalloc(sizeof(ic->fiq_aff[fiq]), GFP_KERNEL);
+	ic->fiq_aff[fiq] = kzalloc(sizeof(unsigned long), GFP_KERNEL);
 	if (!ic->fiq_aff[fiq])
 		return;
 
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ