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:   Fri, 26 Aug 2016 14:50:05 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-cris-kernel@...s.com,
        Adam Buchbinder <adam.buchbinder@...il.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Ingo Molnar <mingo@...nel.org>,
        Jesper Nilsson <jesper.nilsson@...s.com>,
        Jiri Kosina <jkosina@...e.cz>,
        Mikael Starvik <starvik@...s.com>,
        Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>,
        Paolo Bonzini <pbonzini@...hat.com>
Subject: [PATCH 2/8] cris-cryptocop: Improve determination of sizes in five
 functions

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 25 Aug 2016 22:32:27 +0200

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

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 arch/cris/arch-v32/drivers/cryptocop.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index 1632abc..8e04b92 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -323,7 +323,7 @@ static struct cryptocop_dma_desc *alloc_cdesc(int alloc_flag)
 		spin_unlock_irqrestore(&descr_pool_lock, flags);
 		cdesc->from_pool = 1;
 	} else {
-		cdesc = kmalloc(sizeof(struct cryptocop_dma_desc), alloc_flag);
+		cdesc = kmalloc(sizeof(*cdesc), alloc_flag);
 		if (!cdesc) {
 			DEBUG_API(printk("alloc_cdesc: kmalloc\n"));
 			return NULL;
@@ -1526,7 +1526,7 @@ int cryptocop_new_session(cryptocop_session_id *sid, struct cryptocop_transform_
 		return -EINVAL;
 	}
 
-	sess = kmalloc(sizeof(struct cryptocop_session), alloc_flag);
+	sess = kmalloc(sizeof(*sess), alloc_flag);
 	if (!sess){
 		DEBUG_API(printk("cryptocop_new_session, kmalloc cryptocop_session\n"));
 		return -ENOMEM;
@@ -2247,7 +2247,7 @@ static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_
 	int  alloc_flag = operation->in_interrupt ? GFP_ATOMIC : GFP_KERNEL;
 	void *iop_alloc_ptr = NULL;
 
-	*pj = kmalloc(sizeof (struct cryptocop_prio_job), alloc_flag);
+	*pj = kmalloc(sizeof(**pj), alloc_flag);
 	if (!*pj) return -ENOMEM;
 
 	DEBUG(printk("cryptocop_job_setup: operation=0x%p\n", operation));
@@ -2552,12 +2552,12 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
 		return -EFAULT;
 	}
 
-	cop = kmalloc(sizeof(struct cryptocop_operation), GFP_KERNEL);
+	cop = kmalloc(sizeof(*cop), GFP_KERNEL);
 	if (!cop) {
 		DEBUG_API(printk("cryptocop_ioctl_process: kmalloc\n"));
 		return -ENOMEM;
 	}
-	jc = kmalloc(sizeof(struct ioctl_job_cb_ctx), GFP_KERNEL);
+	jc = kmalloc(sizeof(*jc), GFP_KERNEL);
 	if (!jc) {
 		DEBUG_API(printk("cryptocop_ioctl_process: kmalloc\n"));
 		err = -ENOMEM;
@@ -3082,7 +3082,7 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp
 		ti_csum.next = tis;
 		tis = &ti_csum;
 	} /* (sop.csum != cryptocop_csum_none) */
-	dev = kmalloc(sizeof(struct cryptocop_private), GFP_KERNEL);
+	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev){
 		DEBUG_API(printk("create session, alloc dev\n"));
 		return -ENOMEM;
-- 
2.9.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ