[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH for-2.12 v2 11/12] vhdx: Check for 4 GB maximum log
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH for-2.12 v2 11/12] vhdx: Check for 4 GB maximum log size on creation |
Date: |
Wed, 21 Mar 2018 18:37:13 +0100 |
It's unclear what the real maximum is, but we use an uint32_t to store
the log size in vhdx_co_create(), so we should check that the given
value fits in 32 bits.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
---
block/vhdx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/vhdx.c b/block/vhdx.c
index 0e48179b81..a1a0302799 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1829,6 +1829,10 @@ static int coroutine_fn
vhdx_co_create(BlockdevCreateOptions *opts,
if (!vhdx_opts->has_log_size) {
log_size = DEFAULT_LOG_SIZE;
} else {
+ if (vhdx_opts->log_size > UINT32_MAX) {
+ error_setg(errp, "Log size must be smaller than 4 GB");
+ return -EINVAL;
+ }
log_size = vhdx_opts->log_size;
}
if (log_size < MiB || (log_size % MiB) != 0) {
--
2.13.6
- [Qemu-block] [PATCH for-2.12 v2 03/12] qemu-iotests: Test vdi image creation with QMP, (continued)
- [Qemu-block] [PATCH for-2.12 v2 03/12] qemu-iotests: Test vdi image creation with QMP, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 05/12] luks: Turn another invalid assertion into check, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 04/12] qemu-iotests: Enable 025 for luks, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 06/12] qemu-iotests: Test invalid resize on luks, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 07/12] parallels: Check maximum cluster size on create, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 09/12] vhdx: Require power-of-two block size on create, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 10/12] vhdx: Don't use error_setg_errno() with constant errno, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 08/12] qemu-iotests: Test parallels image creation with QMP, Kevin Wolf, 2018/03/21
- [Qemu-block] [PATCH for-2.12 v2 11/12] vhdx: Check for 4 GB maximum log size on creation,
Kevin Wolf <=
- [Qemu-block] [PATCH for-2.12 v2 12/12] qemu-iotests: Test vhdx image creation with QMP, Kevin Wolf, 2018/03/21
- Re: [Qemu-block] [PATCH for-2.12 v2 00/12] block: Follow-up for .bdrv_co_create (part 1), Kevin Wolf, 2018/03/26