ANDROID: 16K: __PAGE_ALIGN dma-bufs size from heap allocations

In order to avoid dma-buf mappings having unaligned end addresses,
__PAGE_ALIGN the buffer size at allocation time.

Bug: 383389337
Bug: 356729201
Change-Id: I4e59d1378f59138db9b58689e32e27ce9f43655c
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
Kalesh Singh
2024-07-31 14:20:47 -07:00
committed by Carlos Llamas
parent 65df6a39b7
commit 36157a52cd

View File

@@ -13,6 +13,7 @@
#include <linux/err.h>
#include <linux/list.h>
#include <linux/nospec.h>
#include <linux/page_size_compat.h>
#include <linux/syscalls.h>
#include <linux/uaccess.h>
#include <linux/xarray.h>
@@ -91,7 +92,7 @@ struct dma_buf *dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
* Allocations from all heaps have to begin
* and end on page boundaries.
*/
len = PAGE_ALIGN(len);
len = __PAGE_ALIGN(len);
if (!len)
return ERR_PTR(-EINVAL);