ion: add alignment check to chunk heap
authorColin Cross <ccross@android.com>
Sat, 14 Dec 2013 03:26:31 +0000 (19:26 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:59:54 +0000 (08:59 -0800)
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_chunk_heap.c

index f21530f..a072089 100644 (file)
@@ -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;