Skip to content

Commit

Permalink
tile-module: Use kmalloc_array() in module_alloc()
Browse files Browse the repository at this point in the history
* 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".

* 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 <elfring@users.sourceforge.net>
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
  • Loading branch information
elfring authored and cmetcalf-tilera committed Dec 16, 2016
1 parent 65f62ce commit 8797fe7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/tile/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void *module_alloc(unsigned long size)
int npages;

npages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
pages = kmalloc(npages * sizeof(struct page *), GFP_KERNEL);
pages = kmalloc_array(npages, sizeof(*pages), GFP_KERNEL);
if (pages == NULL)
return NULL;
for (; i < npages; ++i) {
Expand Down

0 comments on commit 8797fe7

Please sign in to comment.