diff --git a/src/gallium/drivers/panfrost/pan_mempool.c b/src/gallium/drivers/panfrost/pan_mempool.c index 91119997ccf..1a59974df11 100644 --- a/src/gallium/drivers/panfrost/pan_mempool.c +++ b/src/gallium/drivers/panfrost/pan_mempool.c @@ -137,7 +137,9 @@ panfrost_pool_alloc_aligned(struct panfrost_pool *pool, size_t sz, #ifdef PAN_DBG_OVERFLOW if (unlikely(pool->dev->debug & PAN_DBG_OVERFLOW) && !(pool->create_flags & PAN_BO_INVISIBLE)) { - unsigned aligned = ALIGN_POT(sz, sysconf(_SC_PAGESIZE)); + long alignment = sysconf(_SC_PAGESIZE); + assert(alignment > 0 && util_is_power_of_two_nonzero(alignment)); + unsigned aligned = ALIGN_POT(sz, alignment); unsigned bo_size = aligned + PAN_GUARD_SIZE; bo = panfrost_pool_alloc_backing(pool, bo_size);