mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
util: Zero out all of mask in util_set_thread_affinity
memset operates in bytes, and there are 8-bits in a byte. This is a
very easy to miss typo. :(
Fixes: 9758b1d416 ("util: add util_set_thread_affinity helpers including Windows support")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
This commit is contained in:
parent
5971f29c8f
commit
a923e95b10
1 changed files with 2 additions and 2 deletions
|
|
@ -175,7 +175,7 @@ util_set_thread_affinity(thrd_t thread,
|
|||
if (pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset) != 0)
|
||||
return false;
|
||||
|
||||
memset(old_mask, 0, num_mask_bits / 32);
|
||||
memset(old_mask, 0, num_mask_bits / 8);
|
||||
for (unsigned i = 0; i < num_mask_bits && i < CPU_SETSIZE; i++) {
|
||||
if (CPU_ISSET(i, &cpuset))
|
||||
old_mask[i / 32] |= 1u << (i % 32);
|
||||
|
|
@ -200,7 +200,7 @@ util_set_thread_affinity(thrd_t thread,
|
|||
return false;
|
||||
|
||||
if (old_mask) {
|
||||
memset(old_mask, 0, num_mask_bits / 32);
|
||||
memset(old_mask, 0, num_mask_bits / 8);
|
||||
|
||||
old_mask[0] = m;
|
||||
#ifdef _WIN64
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue