mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
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: 264663d55d "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>
(cherry picked from commit 106bf59ca9)
This commit is contained in:
parent
370247f220
commit
34ca8f82af
2 changed files with 3 additions and 3 deletions
|
|
@ -58,7 +58,7 @@
|
|||
"description": "llvmpipe: Use uintptr_t for pointer values",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": "264663d55d321225a4962073ce4b7389d3d42287"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue