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]
Date:   Tue, 9 Jan 2018 19:31:17 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     kernel-janitors@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 3/5] misc/pti: Improve a size determination in two functions

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 9 Jan 2018 18:28:44 +0100

Replace the specification of data structures by pointer dereferences
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>
---
 drivers/misc/pti.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 8292e8098cc8..8ae79b286573 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -243,10 +243,9 @@ static struct pti_masterchannel *get_id(u8 *id_array,
 					int base_id,
 					const char *thread_name)
 {
-	struct pti_masterchannel *mc;
 	int i, j, mask;
+	struct pti_masterchannel *mc = kmalloc(sizeof(*mc), GFP_KERNEL);
 
-	mc = kmalloc(sizeof(struct pti_masterchannel), GFP_KERNEL);
 	if (mc == NULL)
 		return NULL;
 
@@ -465,7 +464,7 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty)
 	int ret = tty_standard_install(driver, tty);
 
 	if (ret == 0) {
-		pti_tty_data = kmalloc(sizeof(struct pti_tty), GFP_KERNEL);
+		pti_tty_data = kmalloc(sizeof(*pti_tty_data), GFP_KERNEL);
 		if (pti_tty_data == NULL)
 			return -ENOMEM;
 
-- 
2.15.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ