mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-03 17:11:32 +00:00
Add assertions that detect some forms of region separator corruption.
This commit is contained in:
parent
a3bb22bc8e
commit
ea41be77ba
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154556
@ -1144,6 +1144,11 @@ static __inline size_t
|
||||
region_next_size_get(region_sep_t *sep)
|
||||
{
|
||||
|
||||
/* The region cannot extend past the end of the containing chunk. */
|
||||
assert(CHUNK_ADDR2OFFSET(&sep[1])
|
||||
+ (size_t) (((sep->bits) & NEXT_SIZE_MASK) << opt_quantum_2pow)
|
||||
<= chunk_size);
|
||||
|
||||
return ((size_t) (((sep->bits) & NEXT_SIZE_MASK) << opt_quantum_2pow));
|
||||
}
|
||||
|
||||
@ -1153,6 +1158,8 @@ region_next_size_set(region_sep_t *sep, size_t size)
|
||||
uint32_t bits;
|
||||
|
||||
assert(size % quantum == 0);
|
||||
/* The region cannot extend past the end of the containing chunk. */
|
||||
assert(CHUNK_ADDR2OFFSET(&sep[1]) + size <= chunk_size);
|
||||
|
||||
bits = sep->bits;
|
||||
bits &= ~NEXT_SIZE_MASK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user