mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-18 22:28:06 +02:00
llvmpipe: fix UB and incorrect value in compute caps shift
`1 << 31` invokes signed shift UB. When the int result is assigned
to uint64_t, sign extension produces 0xFFFFFFFF80000000 (~18 EiB)
instead of the intended 0x80000000 (2 GiB).
Use 1ull << 31 to perform the shift in unsigned 64-bit type.
The 2 GiB value matches the surrounding finite cap values and
OpenCL minimum requirements, making the original intent clear.
Detected by UBSan with piglit.
Fixes: a65b74af51 ("llvmpipe: init shader and compute caps")
Signed-off-by: yserrr <dlwognsdc610@naver.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41464>
This commit is contained in:
parent
f22587abc3
commit
968a13a916
1 changed files with 2 additions and 2 deletions
|
|
@ -175,8 +175,8 @@ llvmpipe_init_compute_caps(struct pipe_screen *screen)
|
|||
|
||||
caps->max_local_size = 32768;
|
||||
caps->grid_dimension = 3;
|
||||
caps->max_global_size = 1 << 31;
|
||||
caps->max_mem_alloc_size = 1 << 31;
|
||||
caps->max_global_size = 1ull << 31;
|
||||
caps->max_mem_alloc_size = 1ull << 31;
|
||||
caps->subgroup_sizes = lp_native_vector_width / 32;
|
||||
caps->max_subgroups = 1024 / (lp_native_vector_width / 32);
|
||||
caps->max_compute_units = 8;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue