etnaviv: Avoid shift overflow
authorJohn Stultz <john.stultz@linaro.org>
Thu, 12 Mar 2020 22:21:29 +0000 (22:21 +0000)
committerMarge Bot <eric+marge@anholt.net>
Thu, 19 Mar 2020 21:20:08 +0000 (21:20 +0000)
commite3bbe1fa65ede1e2504510d15b1c439fb81328fa
tree8735a9a1d75858ee2b9f90cc3cd298ea345f8570
parent511c6408f48097bb4c04087931e3712ade662525
etnaviv: Avoid shift overflow

Building with AOSP I'm seeing:

external/mesa3d/src/gallium/drivers/etnaviv/etnaviv_screen.c:245:31: error: signed shift result (0x100000000) requires 34 bits to represent, but 'int' only has 32 bits [-Werror,-Wshift-overflow]
         system_memory = 4096 << 20;

system_memory is a uint_64t, so this patch addresses the issue
by casting 4096 to a unint_64t before the shift is done.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4175>
src/gallium/drivers/etnaviv/etnaviv_screen.c