diff options
author | Alex Waterman <alexw@nvidia.com> | 2016-10-18 13:46:09 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-10-20 13:44:39 -0400 |
commit | 1cb6d159e271cd10c7815dd5c08fbd520f83223f (patch) | |
tree | 7455d3664e64304c206941b9cae355bf87c8bb7c | |
parent | 15e5a85ae2ae9dc5278df59c8dd298236359cab3 (diff) |
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>
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c index bc769a2b..358b657f 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c | |||
@@ -454,7 +454,7 @@ static struct gk20a_page_alloc *__do_gk20a_alloc_pages( | |||
454 | 454 | ||
455 | while (pages) { | 455 | while (pages) { |
456 | u64 chunk_addr = 0; | 456 | u64 chunk_addr = 0; |
457 | u64 chunk_pages = 1 << __fls(pages); | 457 | u64 chunk_pages = (u64)1 << __fls(pages); |
458 | u64 chunk_len = chunk_pages << a->page_shift; | 458 | u64 chunk_len = chunk_pages << a->page_shift; |
459 | 459 | ||
460 | /* | 460 | /* |