Browse Source

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>
Colin Cross 11 years ago
parent
commit
f0f0676382
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/staging/android/ion/ion_carveout_heap.c

+ 3 - 0
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;
 }