aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2013-11-27 15:53:01 -0800
committerColin Cross <ccross@android.com>2013-12-12 15:27:14 -0800
commit1b1cbed2f4cd92b9ccfd28b985983e2d217ecd2e (patch)
treec5e6b52729643598433d57d70b8bca2095689c32 /drivers/staging
parent049ca90450f8de6bff6c326d6c20ba2959db2e00 (diff)
downloadlinaro-lsk-1b1cbed2f4cd92b9ccfd28b985983e2d217ecd2e.tar.gz
ion: add alignment check to chunk heap
Change-Id: I4be12b9545a81f9b46339a905f00e1e64896b3ed Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'drivers/staging')
-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 8671f12df13..9c0eb5431f8 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;