diff options
author | Rohit Vaswani <rvaswani@codeaurora.org> | 2015-10-22 16:32:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-23 04:55:10 -0400 |
commit | 67a2e213e7e937c41c52ab5bc46bf3f4de469f6e (patch) | |
tree | 7bc4c737953328c9deda1704bcfb1d7432b4b6b2 /mm/cma.c | |
parent | 5211613978cb7353a3237e4372958c0e7514683f (diff) |
mm: cma: fix incorrect type conversion for size during dma allocation
This was found during userspace fuzzing test when a large size dma cma
allocation is made by driver(like ion) through userspace.
show_stack+0x10/0x1c
dump_stack+0x74/0xc8
kasan_report_error+0x2b0/0x408
kasan_report+0x34/0x40
__asan_storeN+0x15c/0x168
memset+0x20/0x44
__dma_alloc_coherent+0x114/0x18c
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/cma.c')
-rw-r--r-- | mm/cma.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -361,7 +361,7 @@ err: | |||
361 | * This function allocates part of contiguous memory on specific | 361 | * This function allocates part of contiguous memory on specific |
362 | * contiguous memory area. | 362 | * contiguous memory area. |
363 | */ | 363 | */ |
364 | struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align) | 364 | struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align) |
365 | { | 365 | { |
366 | unsigned long mask, offset, pfn, start = 0; | 366 | unsigned long mask, offset, pfn, start = 0; |
367 | unsigned long bitmap_maxno, bitmap_no, bitmap_count; | 367 | unsigned long bitmap_maxno, bitmap_no, bitmap_count; |
@@ -371,7 +371,7 @@ struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align) | |||
371 | if (!cma || !cma->count) | 371 | if (!cma || !cma->count) |
372 | return NULL; | 372 | return NULL; |
373 | 373 | ||
374 | pr_debug("%s(cma %p, count %d, align %d)\n", __func__, (void *)cma, | 374 | pr_debug("%s(cma %p, count %zu, align %d)\n", __func__, (void *)cma, |
375 | count, align); | 375 | count, align); |
376 | 376 | ||
377 | if (!count) | 377 | if (!count) |