summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2013-12-14 03:26:31 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-14 16:59:54 (GMT)
commitdd608dd29a417da78f6aa1715efb9786787c550e (patch)
treed05a90684c348a7b5a3d241cc899cc444d922c0e
parentdf6cf5c8af54e3e89643511272f6f5f5cfb71a7d (diff)
downloadlinux-dd608dd29a417da78f6aa1715efb9786787c550e.tar.xz
ion: add alignment check to chunk heap
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>
-rw-r--r--drivers/staging/android/ion/ion_chunk_heap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c
index f21530f..a072089 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;