Free(), FreeRawOrReturnCache(), GetAllocationInfo(), CacheForAddress(): Check
Assert that the meta chunk the given address lies in is actually in use. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37703 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -570,6 +570,7 @@ MemoryManager::Free(void* pages, uint32 flags)
|
|||||||
MetaChunk* metaChunk = &area->metaChunks[
|
MetaChunk* metaChunk = &area->metaChunks[
|
||||||
((addr_t)pages % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
((addr_t)pages % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
||||||
|
|
||||||
|
ASSERT(metaChunk->chunkSize > 0);
|
||||||
ASSERT((addr_t)pages >= metaChunk->chunkBase);
|
ASSERT((addr_t)pages >= metaChunk->chunkBase);
|
||||||
ASSERT(((addr_t)pages % metaChunk->chunkSize) == 0);
|
ASSERT(((addr_t)pages % metaChunk->chunkSize) == 0);
|
||||||
|
|
||||||
@@ -696,6 +697,7 @@ MemoryManager::FreeRawOrReturnCache(void* pages, uint32 flags)
|
|||||||
((addr_t)pages % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
((addr_t)pages % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
||||||
|
|
||||||
// get the chunk
|
// get the chunk
|
||||||
|
ASSERT(metaChunk->chunkSize > 0);
|
||||||
ASSERT((addr_t)pages >= metaChunk->chunkBase);
|
ASSERT((addr_t)pages >= metaChunk->chunkBase);
|
||||||
uint16 chunkIndex = _ChunkIndexForAddress(metaChunk, (addr_t)pages);
|
uint16 chunkIndex = _ChunkIndexForAddress(metaChunk, (addr_t)pages);
|
||||||
Chunk* chunk = &metaChunk->chunks[chunkIndex];
|
Chunk* chunk = &metaChunk->chunks[chunkIndex];
|
||||||
@@ -760,6 +762,7 @@ MemoryManager::GetAllocationInfo(void* address, size_t& _size)
|
|||||||
((addr_t)address % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
((addr_t)address % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
||||||
|
|
||||||
// get the chunk
|
// get the chunk
|
||||||
|
ASSERT(metaChunk->chunkSize > 0);
|
||||||
ASSERT((addr_t)address >= metaChunk->chunkBase);
|
ASSERT((addr_t)address >= metaChunk->chunkBase);
|
||||||
uint16 chunkIndex = _ChunkIndexForAddress(metaChunk, (addr_t)address);
|
uint16 chunkIndex = _ChunkIndexForAddress(metaChunk, (addr_t)address);
|
||||||
|
|
||||||
@@ -790,6 +793,7 @@ MemoryManager::CacheForAddress(void* address)
|
|||||||
((addr_t)address % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
((addr_t)address % SLAB_AREA_SIZE) / SLAB_CHUNK_SIZE_LARGE];
|
||||||
|
|
||||||
// get the chunk
|
// get the chunk
|
||||||
|
ASSERT(metaChunk->chunkSize > 0);
|
||||||
ASSERT((addr_t)address >= metaChunk->chunkBase);
|
ASSERT((addr_t)address >= metaChunk->chunkBase);
|
||||||
uint16 chunkIndex = _ChunkIndexForAddress(metaChunk, (addr_t)address);
|
uint16 chunkIndex = _ChunkIndexForAddress(metaChunk, (addr_t)address);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user