From: Jianpeng Ma Date: Thu, 10 Jan 2013 12:19:27 +0000 (+0100) Subject: Fix a potential integer overflow X-Git-Tag: fio-2.0.14~132 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=1983e3271c20a5dca84ac1ad872e44dd9e62e6b8 Fix a potential integer overflow Because nr_files and new_size are not same types.It can cause new_size less than zero.Then realloc will be failed. Signed-off-by: Jianpeng Ma Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index b1ca9217..69eb37cd 100644 --- a/filesetup.c +++ b/filesetup.c @@ -1074,7 +1074,7 @@ int add_file(struct thread_data *td, const char *fname) fio_file_reset(f); if (td->files_size <= td->files_index) { - int new_size = td->o.nr_files + 1; + unsigned int new_size = td->o.nr_files + 1; dprint(FD_FILE, "resize file array to %d files\n", new_size);