mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-04-19 22:10:19 +02:00
improve interaction of slot rand with slot mask
This commit is contained in:
parent
173dd6e7a5
commit
c5d76179a5
1 changed files with 1 additions and 1 deletions
2
malloc.c
2
malloc.c
|
@ -257,7 +257,7 @@ static size_t get_free_slot(struct random_state *rng, size_t slots, struct slab_
|
||||||
}
|
}
|
||||||
|
|
||||||
// randomize start location for linear search (uniform random choice is too slow)
|
// randomize start location for linear search (uniform random choice is too slow)
|
||||||
uint64_t random_split = ~0UL >> get_random_size_uniform(rng, slots);
|
uint64_t random_split = ~(~0UL << get_random_size_uniform(rng, slots));
|
||||||
|
|
||||||
size_t slot = ffzl(masked | random_split);
|
size_t slot = ffzl(masked | random_split);
|
||||||
if (slot) {
|
if (slot) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue