Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1470703
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/8] cris-cryptocop: Improve determination of sizes in five functions |
| Date | 2016-08-26 15:00 +0200 |
| Message-ID | <saoTM-7aM-43@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <saoTL-7aM-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.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@users.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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] cris-cryptocop: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:00 +0200
[PATCH 3/8] cris-cryptocop: Delete unnecessary braces SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:00 +0200
[PATCH 7/8] cris-cryptocop: Delete unnecessary variable initialisations in cryptocop_ioctl_process() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:00 +0200
[PATCH 4/8] cris-cryptocop: Less function calls in cryptocop_ioctl_process() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:00 +0200
[PATCH 6/8] cris-cryptocop: Delete two variables in cryptocop_ioctl_process() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:00 +0200
[PATCH 2/8] cris-cryptocop: Improve determination of sizes in five functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:00 +0200
[PATCH 8/8] cris-cryptocop: Apply another recommendation from "checkpatch.pl" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-26 15:10 +0200
Re: [PATCH 8/8] cris-cryptocop: Apply another recommendation from "checkpatch.pl" Julia Lawall <julia.lawall@lip6.fr> - 2016-08-27 21:10 +0200
Re: [PATCH 8/8] cris-cryptocop: Apply another recommendation from "checkpatch.pl" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-28 09:20 +0200
Re: [PATCH 8/8] cris-cryptocop: Apply another recommendation from "checkpatch.pl" Julia Lawall <julia.lawall@lip6.fr> - 2016-08-28 12:30 +0200
Re: cris-cryptocop: Apply another recommendation from "checkpatch.pl" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-28 15:30 +0200
csiph-web