llvmpipe: Use uintptr_t for pointer values
authorMichel Dänzer <mdaenzer@redhat.com>
Thu, 12 Mar 2020 14:03:20 +0000 (15:03 +0100)
committerMichel Dänzer <michel@daenzer.net>
Tue, 17 Mar 2020 10:20:49 +0000 (11:20 +0100)
commit106bf59ca903bd58c0bd2a9c5eff6b4180df0b24
treee3c666248e20603262ec7c8d1daa4e8d36be43f2
parentc56f09124b195c5cbaabdd7eadbb0523bede3abb
llvmpipe: Use uintptr_t for pointer values

Instead of uint64_t. Fixes potentially writing beyond the end of the
handles pointer array on 32-bit architectures (and copying all 0s
instead of the computed pointer values to the array on big endian
ones).

Corresponding compiler warning:

../src/gallium/drivers/llvmpipe/lp_state_cs.c: In function ‘llvmpipe_set_global_binding’:
../src/gallium/drivers/llvmpipe/lp_state_cs.c:1312:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 1312 |       va = (uint64_t)((char *)lp_res->data + offset);
      |            ^

Fixes: 264663d55d32 "gallivm/llvmpipe: add support for global
                     operations."

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4166>
src/gallium/drivers/llvmpipe/lp_state_cs.c