summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2013-12-14 03:26:20 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-14 16:59:53 (GMT)
commitf0f06763820e5b5f6e13afa814e68e8f4d955c45 (patch)
treec864794a1dc06f573c58bf7e9b546ab32189cb89
parent797e88be2f3e928fe5d8498f42a65a6e77b09c29 (diff)
downloadlinux-f0f06763820e5b5f6e13afa814e68e8f4d955c45.tar.xz
ion: add alignment check to carveout 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_carveout_heap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c
index 1d53e91..b0b08c3 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -70,6 +70,9 @@ static int ion_carveout_heap_allocate(struct ion_heap *heap,
unsigned long size, unsigned long align,
unsigned long flags)
{
+ if (align > PAGE_SIZE)
+ return -EINVAL;
+
buffer->priv_phys = ion_carveout_allocate(heap, size, align);
return buffer->priv_phys == ION_CARVEOUT_ALLOCATE_FAIL ? -ENOMEM : 0;
}