Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion h_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,10 @@ static size_t get_free_slot(struct random_state *rng, size_t slots, const struct
}

i = i == (slots - 1) / U64_WIDTH ? 0 : i + 1;
masked = metadata->bitmap[i];
// false positive: i is bounded by the bitmap length since slots is limited to
// MAX_SLAB_SLOT_COUNT (256) and random_index is bounded by slots, but the
// analyzer can't see either bound across translation units
masked = metadata->bitmap[i]; // NOLINT(clang-analyzer-security.ArrayBound)
}
} else {
for (size_t i = 0; i <= (slots - 1) / U64_WIDTH; i++) {
Expand Down
2 changes: 1 addition & 1 deletion util.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef unsigned __int128 u128;
#define U64_WIDTH 64

static inline int ffz64(u64 x) {
return __builtin_ffsll(~x);
return __builtin_ffsll((int64_t) ~x);
}

// parameter must not be 0
Expand Down