From 7982aa7da64b68f38c7ec685a428334e3af4e340 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 2 Nov 2012 16:35:18 +0100 Subject: [PATCH] smalloc: fix int truncation issue Signed-off-by: Jens Axboe --- smalloc.c | 5 ++++- smalloc.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/smalloc.c b/smalloc.c index d0b6f1e1..9f40f65a 100644 --- a/smalloc.c +++ b/smalloc.c @@ -431,10 +431,13 @@ static void *smalloc_pool(struct pool *pool, unsigned int size) return ptr; } -void *smalloc(unsigned int size) +void *smalloc(size_t size) { unsigned int i; + if (size != (unsigned int) size) + return NULL; + global_write_lock(); i = last_pool; diff --git a/smalloc.h b/smalloc.h index 6905c6a8..f9a5e410 100644 --- a/smalloc.h +++ b/smalloc.h @@ -1,7 +1,7 @@ #ifndef FIO_SMALLOC_H #define FIO_SMALLOC_H -extern void *smalloc(unsigned int); +extern void *smalloc(size_t); extern void sfree(void *); extern char *smalloc_strdup(const char *); extern void sinit(void); -- 2.25.1