* [PATCH] fix an overflowing.
@ 2013-01-10 11:37 majianpeng
2013-01-10 12:18 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2013-01-10 11:37 UTC (permalink / raw)
To: Jens Axboe; +Cc: fio
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 <majianpeng@gmail.com>
---
filesetup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/filesetup.c b/filesetup.c
index 324e9a6..c55ff3f 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);
td->files = realloc(td->files, new_size * sizeof(f));
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-10 12:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 11:37 [PATCH] fix an overflowing majianpeng
2013-01-10 12:18 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.