ion: add alignment check to carveout heap
authorColin Cross <ccross@android.com>
Sat, 14 Dec 2013 03:26:20 +0000 (19:26 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:59:53 +0000 (08:59 -0800)
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>
drivers/staging/android/ion/ion_carveout_heap.c

index 1d53e9120b90c2e72615fefaad19ca5d8b12aa30..b0b08c30f6f0a3554bc685b7864d3fd6d71b8783 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;
 }