gpu: nvgpu: Fix coverity problem

Coverity detected a possible overflow during the left shift.
This is likely not a big problem, though, since the number
of pages to allocate would have to be greater than 2^32
(that would be 4 TB of memory assuming 4k page size and the
literal 1 being a signed int by default).

Bug 1799159

Change-Id: Ie1d6522defd13c794eb95aeee8c5c4203db00ebf
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1238632
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Alex Waterman
2016-10-18 10:46:09 -07:00
committed by mobile promotions
parent 15e5a85ae2
commit 1cb6d159e2

View File

@@ -454,7 +454,7 @@ static struct gk20a_page_alloc *__do_gk20a_alloc_pages(
while (pages) {
u64 chunk_addr = 0;
u64 chunk_pages = 1 << __fls(pages);
u64 chunk_pages = (u64)1 << __fls(pages);
u64 chunk_len = chunk_pages << a->page_shift;
/*