The allocation size td->o.max_bs[DDIR_XXX] can be specified by user,
so test the result although it can be over committed on some platforms.
In theory allocation size could be as large as maximum of uint.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
}
b = malloc(td->o.max_bs[DDIR_WRITE]);
+ if (!b) {
+ td_verror(td, errno, "malloc");
+ goto err;
+ }
left = f->real_file_size;
while (left && !td->terminate) {
bs = td->o.max_bs[DDIR_READ];
b = malloc(bs);
+ if (!b) {
+ td_verror(td, errno, "malloc");
+ ret = 1;
+ goto error;
+ }
memset(b, 0, bs);
if (lseek(f->fd, f->file_offset, SEEK_SET) < 0) {