From 1601cc905c8b42d8b1735e0767ac753df8805ad9 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 27 May 2008 14:44:23 +0200 Subject: [PATCH] smalloc: fix off-by-one in ptr_valid() Signed-off-by: Jens Axboe --- smalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smalloc.c b/smalloc.c index c03c4040..e97ba011 100644 --- a/smalloc.c +++ b/smalloc.c @@ -90,7 +90,7 @@ static inline void global_write_unlock(void) static inline int ptr_valid(struct pool *pool, void *ptr) { - unsigned int pool_size = pool->nr_blocks * SMALLOC_BPL; + unsigned int pool_size = (pool->nr_blocks + 1) * SMALLOC_BPL; return (ptr >= pool->map) && (ptr < pool->map + pool_size); } -- 2.25.1