diff options
author | Colin Cross <ccross@android.com> | 2013-12-13 19:26:31 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-14 08:59:54 -0800 |
commit | dd608dd29a417da78f6aa1715efb9786787c550e (patch) | |
tree | d05a90684c348a7b5a3d241cc899cc444d922c0e /drivers/staging/android/ion/ion_chunk_heap.c | |
parent | df6cf5c8af54e3e89643511272f6f5f5cfb71a7d (diff) |
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>
Diffstat (limited to 'drivers/staging/android/ion/ion_chunk_heap.c')
-rw-r--r-- | drivers/staging/android/ion/ion_chunk_heap.c | 3 |
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 f21530f4f7ae..a0720891fe4e 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; |