aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2016-09-03 14:40:57 -0400
committerChris Metcalf <cmetcalf@mellanox.com>2016-12-16 15:32:29 -0500
commit8797fe75f164d4b2f183e776003612ece565c76e (patch)
treebcec729149c8c7060c6f1b739979f05442dacfa4
parent65f62ce8492139bd5caea77dfce724c540efc4eb (diff)
tile-module: Use kmalloc_array() in module_alloc()
* 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>
-rw-r--r--arch/tile/kernel/module.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c
index 2305084c9b93..dce4120f5263 100644
--- a/arch/tile/kernel/module.c
+++ b/arch/tile/kernel/module.c
@@ -43,7 +43,7 @@ void *module_alloc(unsigned long size)
43 int npages; 43 int npages;
44 44
45 npages = (size + PAGE_SIZE - 1) / PAGE_SIZE; 45 npages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
46 pages = kmalloc(npages * sizeof(struct page *), GFP_KERNEL); 46 pages = kmalloc_array(npages, sizeof(*pages), GFP_KERNEL);
47 if (pages == NULL) 47 if (pages == NULL)
48 return NULL; 48 return NULL;
49 for (; i < npages; ++i) { 49 for (; i < npages; ++i) {