Commit c4351d98 authored by Markus Elfring's avatar Markus Elfring Committed by Helge Deller

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 5baf919d
...@@ -506,7 +506,7 @@ add_system_map_addresses(struct parisc_device *dev, int num_addrs, ...@@ -506,7 +506,7 @@ add_system_map_addresses(struct parisc_device *dev, int num_addrs,
long status; long status;
struct pdc_system_map_addr_info addr_result; 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) { if(!dev->addr) {
printk(KERN_ERR "%s %s(): memory allocation failure\n", printk(KERN_ERR "%s %s(): memory allocation failure\n",
__FILE__, __func__); __FILE__, __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment