Re: [PATCH] btrfs:check-integrity.c: replace kmalloc with kmalloc_array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 01, 2013 at 06:16:00AM +0530, Himangi Saraogi wrote:
> This patch replaces kmalloc(size * nr, ) with kmalloc_array(nr, size)
> as kmalloc_array() is preferred because it can check that the
> calculation doesn't wrap and won't return a smaller allocation.

Can you please convert all the instances in one patch? Feel free to use
the following cocinelle script, that found ~16 places that could use
the conversion.

$ cat kmalloc_array.cocci
@ @
expression E1, E2, E3;
@@

* \(kmalloc\|kzalloc\)(E1 * E2, E3)
---

The output is not a straight patch, the instances have to be reviewed manually
because the order of nritems and size may differ at each location.

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux