Skip to content

Commit

Permalink
ste_dma40: Use kmalloc_array() in d40_lcla_allocate()
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".

  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 <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
elfring authored and Vinod Koul committed Sep 26, 2016
1 parent 29b4817 commit cf80ecf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/dma/ste_dma40.c
Original file line number Diff line number Diff line change
Expand Up @@ -3411,9 +3411,9 @@ static int __init d40_lcla_allocate(struct d40_base *base)
* To full fill this hardware requirement without wasting 256 kb
* we allocate pages until we get an aligned one.
*/
page_list = kmalloc(sizeof(unsigned long) * MAX_LCLA_ALLOC_ATTEMPTS,
GFP_KERNEL);

page_list = kmalloc_array(MAX_LCLA_ALLOC_ATTEMPTS,
sizeof(*page_list),
GFP_KERNEL);
if (!page_list) {
ret = -ENOMEM;
goto failure;
Expand Down

0 comments on commit cf80ecf

Please sign in to comment.