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: <c2a6e5a5-0120-d16f-d809-8d5a67fba413@users.sourceforge.net>
Date:   Wed, 4 Oct 2017 20:46:15 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-cris-kernel@...s.com,
        Alexander Sverdlin <alexander.sverdlin@...il.com>,
        Boris Brezillon <boris.brezillon@...e-electrons.com>,
        Gregory Clement <gregory.clement@...e-electrons.com>,
        Jesper Nilsson <jesper.nilsson@...s.com>,
        Krzysztof Halasa <khalasa@...p.pl>,
        Mikael Starvik <starvik@...s.com>,
        Neil Armstrong <narmstrong@...libre.com>,
        Shawn Guo <shawnguo@...nel.org>,
        Tony Lindgren <tony@...mide.com>,
        Vladimir Zapolskiy <vz@...ia.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 2/5] cris: nand: Improve a size determination in
 crisv32_nand_flash_probe()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 4 Oct 2017 18:00:33 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 2 +-
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
index 259aa1f46fbe..3b5be9b984b4 100644
--- a/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-a3/nandflash.c
@@ -134,7 +134,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
 	REG_WR(pio, regi_pio, rw_oe, oe);
 
 	/* Allocate memory for MTD device structure and private data */
-	wrapper = kzalloc(sizeof(struct mtd_info_wrapper), GFP_KERNEL);
+	wrapper = kzalloc(sizeof(*wrapper), GFP_KERNEL);
 	if (!wrapper) {
 		err = -ENOMEM;
 		return NULL;
diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
index 1baf16ee74e8..5dfd72a89b8a 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
@@ -109,7 +109,7 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
 	int err = 0;
 
 	/* Allocate memory for MTD device structure and private data */
-	wrapper = kzalloc(sizeof(struct mtd_info_wrapper), GFP_KERNEL);
+	wrapper = kzalloc(sizeof(*wrapper), GFP_KERNEL);
 	if (!wrapper) {
 		err = -ENOMEM;
 		return NULL;
-- 
2.14.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ