Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: mic: drop double zeroing

sg_init_table zeroes its first argument, so the allocation of that argument
doesn't have to.

the semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,n,flags;
@@

x =
- kcalloc
+ kmalloc_array
(n,sizeof(struct scatterlist),flags)
...
sg_init_table(x,n)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1600601186-7420-14-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Julia Lawall and committed by
Greg Kroah-Hartman
45337656 5b94d6e4

+1 -1
+1 -1
drivers/misc/mic/scif/scif_nodeqp.c
··· 363 363 struct page *page; 364 364 int i; 365 365 366 - sg = kcalloc(page_cnt, sizeof(struct scatterlist), GFP_KERNEL); 366 + sg = kmalloc_array(page_cnt, sizeof(struct scatterlist), GFP_KERNEL); 367 367 if (!sg) 368 368 return NULL; 369 369 sg_init_table(sg, page_cnt);