aboutsummaryrefslogtreecommitdiff
path: root/block/blklogwrites.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blklogwrites.c')
-rw-r--r--block/blklogwrites.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/block/blklogwrites.c b/block/blklogwrites.c
index 63bf6b3..ff98cd5 100644
--- a/block/blklogwrites.c
+++ b/block/blklogwrites.c
@@ -89,7 +89,10 @@ static inline uint32_t blk_log_writes_log2(uint32_t value)
static inline bool blk_log_writes_sector_size_valid(uint32_t sector_size)
{
- return sector_size < (1ull << 24) && is_power_of_2(sector_size);
+ return is_power_of_2(sector_size) &&
+ sector_size >= sizeof(struct log_write_super) &&
+ sector_size >= sizeof(struct log_write_entry) &&
+ sector_size < (1ull << 24);
}
static uint64_t blk_log_writes_find_cur_log_sector(BdrvChild *log,
@@ -483,7 +486,7 @@ static int coroutine_fn blk_log_writes_co_do_file_flush(BlkLogWritesFileReq *fr)
static int coroutine_fn
blk_log_writes_co_do_file_pdiscard(BlkLogWritesFileReq *fr)
{
- return bdrv_co_pdiscard(fr->bs->file->bs, fr->offset, fr->bytes);
+ return bdrv_co_pdiscard(fr->bs->file, fr->offset, fr->bytes);
}
static int coroutine_fn