From: Markus Elfring Date: Sun, 28 Aug 2016 09:40:53 +0000 (+0200) Subject: parisc: Use kmalloc_array() in add_system_map_addresses() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c4351d980ed88ac290136bfe59c8bd2b95f12b63;p=linux-beck.git parisc: Use kmalloc_array() in add_system_map_addresses() * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring Signed-off-by: Helge Deller --- diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c index f0b6722fc706..545f9d2fe711 100644 --- a/arch/parisc/kernel/inventory.c +++ b/arch/parisc/kernel/inventory.c @@ -506,7 +506,7 @@ add_system_map_addresses(struct parisc_device *dev, int num_addrs, long status; struct pdc_system_map_addr_info addr_result; - dev->addr = kmalloc(num_addrs * sizeof(unsigned long), GFP_KERNEL); + dev->addr = kmalloc_array(num_addrs, sizeof(*dev->addr), GFP_KERNEL); if(!dev->addr) { printk(KERN_ERR "%s %s(): memory allocation failure\n", __FILE__, __func__);