diff --git a/xen/common/xmalloc_tlsf.c b/xen/common/xmalloc_tlsf.c index 349b31cb4cc1..5e55fc463e7d 100644 --- a/xen/common/xmalloc_tlsf.c +++ b/xen/common/xmalloc_tlsf.c @@ -249,11 +249,14 @@ static inline void EXTRACT_BLOCK(struct bhdr *b, struct xmem_pool *p, int fl, } b->ptr.free_ptr = (struct free_ptr) {NULL, NULL}; -#ifdef CONFIG_XMEM_POOL_POISON - if ( (b->size & BLOCK_SIZE_MASK) > MIN_BLOCK_SIZE ) - ASSERT(!memchr_inv(b->ptr.buffer + MIN_BLOCK_SIZE, POISON_BYTE, - (b->size & BLOCK_SIZE_MASK) - MIN_BLOCK_SIZE)); -#endif /* CONFIG_XMEM_POOL_POISON */ + if ( IS_ENABLED(CONFIG_XMEM_POOL_POISON) && + (b->size & BLOCK_SIZE_MASK) > MIN_BLOCK_SIZE && + memchr_inv(b->ptr.buffer + MIN_BLOCK_SIZE, POISON_BYTE, + (b->size & BLOCK_SIZE_MASK) - MIN_BLOCK_SIZE) ) + { + printk(XENLOG_ERR "XMEM Pool corruption found"); + BUG(); + } } /** @@ -261,11 +264,10 @@ static inline void EXTRACT_BLOCK(struct bhdr *b, struct xmem_pool *p, int fl, */ static inline void INSERT_BLOCK(struct bhdr *b, struct xmem_pool *p, int fl, int sl) { -#ifdef CONFIG_XMEM_POOL_POISON - if ( (b->size & BLOCK_SIZE_MASK) > MIN_BLOCK_SIZE ) + if ( IS_ENABLED(CONFIG_XMEM_POOL_POISON) && + (b->size & BLOCK_SIZE_MASK) > MIN_BLOCK_SIZE ) memset(b->ptr.buffer + MIN_BLOCK_SIZE, POISON_BYTE, (b->size & BLOCK_SIZE_MASK) - MIN_BLOCK_SIZE); -#endif /* CONFIG_XMEM_POOL_POISON */ b->ptr.free_ptr = (struct free_ptr) {NULL, p->matrix[fl][sl]}; if ( p->matrix[fl][sl] )