aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2020-03-12 15:03:20 +0100
committerMichel Dänzer <[email protected]>2020-03-17 11:20:49 +0100
commit106bf59ca903bd58c0bd2a9c5eff6b4180df0b24 (patch)
treee3c666248e20603262ec7c8d1daa4e8d36be43f2 /src/gallium/drivers/llvmpipe
parentc56f09124b195c5cbaabdd7eadbb0523bede3abb (diff)
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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4166>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_cs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c
index 92e156b4111..b57e1068a06 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_cs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c
@@ -1304,12 +1304,12 @@ llvmpipe_set_global_binding(struct pipe_context *pipe,
}
for (i = 0; i < count; i++) {
- uint64_t va;
+ uintptr_t va;
uint32_t offset;
pipe_resource_reference(&cs->global_buffers[first + i], resources[i]);
struct llvmpipe_resource *lp_res = llvmpipe_resource(resources[i]);
offset = *handles[i];
- va = (uint64_t)((char *)lp_res->data + offset);
+ va = (uintptr_t)((char *)lp_res->data + offset);
memcpy(handles[i], &va, sizeof(va));
}
}