Compression buffer fill fix
authorJens Axboe <axboe@kernel.dk>
Fri, 9 Mar 2012 18:00:31 +0000 (19:00 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 9 Mar 2012 18:00:31 +0000 (19:00 +0100)
We need to advance after the zero fill as well.

Reported-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/rand.c

index 995035f..a79fb9c 100644 (file)
@@ -125,6 +125,8 @@ unsigned long fill_random_buf_percentage(struct frand_state *fs, void *buf,
                        this_len = len;
 
                memset(buf, 0, this_len);
+               len -= this_len;
+               buf += this_len;
        }
 
        return r;