From bd95a0c5ff3d61a1daddc41eaad543a5f5f80a7f Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Tue, 16 Oct 2018 15:24:44 -0400 Subject: [PATCH] gpu: nvgpu: fix malloc in POSIX dma module This fixes a bug where the POSIX dma module was calling malloc for dma allocation requests with the incorrect size. Bug found as a result of JIRA NVGPU-1235 Change-Id: Ia2933dc90f12d84a7da91a50eb3eafd6eb0e129e Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/1930799 GVS: Gerrit_Virtual_Submit Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/posix/posix-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/os/posix/posix-dma.c b/drivers/gpu/nvgpu/os/posix/posix-dma.c index e8c5c9d4b..7259dfa27 100644 --- a/drivers/gpu/nvgpu/os/posix/posix-dma.c +++ b/drivers/gpu/nvgpu/os/posix/posix-dma.c @@ -38,7 +38,7 @@ static int __nvgpu_do_dma_alloc(struct gk20a *g, unsigned long flags, size_t size, struct nvgpu_mem *mem, enum nvgpu_aperture ap) { - void *memory = malloc(mem->aligned_size); + void *memory = malloc(PAGE_ALIGN(size)); if (memory == NULL) return -ENOMEM;