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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon,  4 Apr 2016 21:52:51 +0530
From:	Vaishali Thakkar <vaishali.thakkar@...cle.com>
To:	zohar@...ux.vnet.ibm.com
Cc:	dmitry.kasatkin@...il.com, james.l.morris@...cle.com,
	linux-ima-devel@...ts.sourceforge.net, serge@...lyn.com,
	linux-ima-user@...ts.sourceforge.net,
	linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Vaishali Thakkar <vaishali.thakkar@...cle.com>
Subject: [PATCH] ima: Use sizeof struct rather than pointer

When sizeof the pointer is applied to a pointer typed expression it
gives the size of the pointer. Here, for the cleanness sake, let's
not use sizeof the pointer. This does not actually change the behavior
of the code as both being pointers, *fields and **fields have the same
size and fields is a ***.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@...cle.com>
---
 security/integrity/ima/ima_template.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index febd12e..fdba86f 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -171,11 +171,11 @@ static int template_desc_init_fields(const char *template_fmt,
 	}
 
 	if (fields && num_fields) {
-		*fields = kmalloc_array(i, sizeof(*fields), GFP_KERNEL);
+		*fields = kmalloc_array(i, sizeof(**fields), GFP_KERNEL);
 		if (*fields == NULL)
 			return -ENOMEM;
 
-		memcpy(*fields, found_fields, i * sizeof(*fields));
+		memcpy(*fields, found_fields, i * sizeof(**fields));
 		*num_fields = i;
 	}
 
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ