From 1cb6d159e271cd10c7815dd5c08fbd520f83223f Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 18 Oct 2016 10:46:09 -0700 Subject: 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 Reviewed-on: http://git-master/r/1238632 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu') 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( 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; /* -- cgit v1.2.2