From: Jens Axboe Date: Fri, 2 Nov 2012 15:35:18 +0000 (+0100) Subject: smalloc: fix int truncation issue X-Git-Tag: fio-2.0.11~39^2~2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7982aa7da64b68f38c7ec685a428334e3af4e340 smalloc: fix int truncation issue Signed-off-by: Jens Axboe --- 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);