summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2015-05-26 18:15:56 -0400
committerAlex Waterman <alexw@nvidia.com>2015-07-20 14:32:57 -0400
commit4a3f84d257686cf598e8cfc27bb1735af65271a3 (patch)
treee95469f338e697b75b1fde344b9c52b2738e72bf /drivers
parente60b7deec46b805582ab206d4ca3a4d213aad3bb (diff)
gpu: nvgpu: Fix overflow of alloc length
Fix an issue where large ( > 4GB) allocations were not being computed correctly. The two fields, pages and page_size, were both 32 bits so when multiplied they easily overflowed. Simple fix is to cast them to 64 bits before multiplying them. Change-Id: I63fa54679e485de5c3a99684cbeb72c6cdc65504 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/747429 Reviewed-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/771148 Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 1e0fd6af..0deadfd0 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -2816,7 +2816,9 @@ int gk20a_vm_alloc_space(struct gk20a_as_share *as_share,
2816 (u64)args->pages * 2816 (u64)args->pages *
2817 (u64)args->page_size); 2817 (u64)args->page_size);
2818 else 2818 else
2819 vaddr_start = gk20a_balloc(vma, args->pages * args->page_size); 2819 vaddr_start = gk20a_balloc(vma,
2820 (u64)args->pages *
2821 (u64)args->page_size);
2820 2822
2821 if (!vaddr_start) { 2823 if (!vaddr_start) {
2822 kfree(va_node); 2824 kfree(va_node);