From: Colin Cross Date: Wed, 27 Nov 2013 23:53:01 +0000 (-0800) Subject: ion: add alignment check to chunk heap X-Git-Tag: firefly_0821_release~4090^2~438 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1b1cbed2f4cd92b9ccfd28b985983e2d217ecd2e;p=firefly-linux-kernel-4.4.55.git ion: add alignment check to chunk heap Change-Id: I4be12b9545a81f9b46339a905f00e1e64896b3ed Signed-off-by: Colin Cross --- diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c index 8671f12df131..9c0eb5431f87 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;