ion: add alignment check to carveout heap
authorColin Cross <ccross@android.com>
Tue, 26 Nov 2013 21:43:29 +0000 (13:43 -0800)
committerColin Cross <ccross@android.com>
Thu, 12 Dec 2013 23:27:08 +0000 (15:27 -0800)
Change-Id: I25c752b3eacb48cccea5be2df319634b3affd331
Signed-off-by: Colin Cross <ccross@android.com>
drivers/staging/android/ion/ion_carveout_heap.c

index ed2b7ae709644b82569266218165aba2e4b8e04b..128ee115e60e8a4d63e1d0899394953e776434b6 100644 (file)
@@ -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;
 }