From: Colin Cross Date: Sat, 14 Dec 2013 03:26:31 +0000 (-0800) Subject: ion: add alignment check to chunk heap X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=dd608dd29a417da78f6aa1715efb9786787c550e;p=linux-beck.git ion: add alignment check to chunk heap Signed-off-by: Colin Cross Signed-off-by: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c index f21530f4f7ae..a0720891fe4e 100644 --- a/drivers/staging/android/ion/ion_chunk_heap.c +++ b/drivers/staging/android/ion/ion_chunk_heap.c @@ -47,6 +47,9 @@ static int ion_chunk_heap_allocate(struct ion_heap *heap, unsigned long num_chunks; unsigned long allocated_size; + if (align > chunk_heap->chunk_size) + return -EINVAL; + allocated_size = ALIGN(size, chunk_heap->chunk_size); num_chunks = allocated_size / chunk_heap->chunk_size;