瀏覽代碼

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>
Markus Elfring 9 年之前
父節點
當前提交
8797fe75f1
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      arch/tile/kernel/module.c

+ 1 - 1
arch/tile/kernel/module.c

@@ -43,7 +43,7 @@ void *module_alloc(unsigned long size)
 	int npages;
 	int npages;
 
 
 	npages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
 	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)
 	if (pages == NULL)
 		return NULL;
 		return NULL;
 	for (; i < npages; ++i) {
 	for (; i < npages; ++i) {