diff --git a/sys/boot/common/bcache.c b/sys/boot/common/bcache.c index 4bb9082bea2..c935c90f938 100644 --- a/sys/boot/common/bcache.c +++ b/sys/boot/common/bcache.c @@ -303,7 +303,9 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset, break; } - size = i * bcache_blksize; + if (size > i * bcache_blksize) + size = i * bcache_blksize; + if (size != 0) { bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, buf, size);