ion: add alignment check to chunk heap
authorColin Cross <ccross@android.com>
Wed, 27 Nov 2013 23:53:01 +0000 (15:53 -0800)
committerColin Cross <ccross@android.com>
Thu, 12 Dec 2013 23:27:14 +0000 (15:27 -0800)
Change-Id: I4be12b9545a81f9b46339a905f00e1e64896b3ed
Signed-off-by: Colin Cross <ccross@android.com>
drivers/staging/android/ion/ion_chunk_heap.c

index 8671f12df131bb80cb08551ebbc4929a08bf085a..9c0eb5431f8717c419008b4f677a6f3e8a174b2a 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;