fix an overflowing.
PATCH 1/1 fix an overflowing.
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 <[email protected]>
--- filesetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
filesetup.c +1 -1
@@ -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); td->files =realloc (td->files, new_size *sizeof (f));
Signature · 1 line
1.7.9.5
Jens Axboe
AppliedQuoted 2 lines · majianpeng
Because
nr_filesandnew_sizeare not same types.It can causenew_sizeless than zero.Then realloc will be failed.
Thanks, applied.
Signature · 1 line
Jens Axboe