projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
9f9214f
)
Obscure file randommap fix
author
Jens Axboe
<jens.axboe@oracle.com>
Tue, 13 Mar 2007 13:16:08 +0000
(14:16 +0100)
committer
Jens Axboe
<jens.axboe@oracle.com>
Tue, 13 Mar 2007 13:16:08 +0000
(14:16 +0100)
If file size < block and no size is given, we could be generating
a random offset within -1 and deref ->file_map[] beyond its size.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
io_u.c
patch
|
blob
|
blame
|
history
diff --git
a/io_u.c
b/io_u.c
index 10fa188dd9aa0eb6d7900cc6c6a151cafb337eba..fead400cd7c5759d34ad2210f06c5ecee0335145 100644
(file)
--- a/
io_u.c
+++ b/
io_u.c
@@
-109,6
+109,9
@@
static int get_next_offset(struct thread_data *td, struct io_u *io_u)
unsigned long long max_blocks = f->file_size / td->min_bs[ddir];
int loops = 5;
+ if (!max_blocks)
+ return 1;
+
do {
r = os_random_long(&td->random_state);
b = ((max_blocks - 1) * r / (unsigned long long) (RAND_MAX+1.0));