qemu/block
Alberto Garcia 0cf0e5980b qcow2: Generalize validate_table_offset() into qcow2_validate_table()
This function checks that the offset and size of a table are valid.

While the offset checks are fine, the size check is too generic, since
it only verifies that the total size in bytes fits in a 64-bit
integer. In practice all tables used in qcow2 have much smaller size
limits, so the size needs to be checked again for each table using its
actual limit.

This patch generalizes this function by allowing the caller to specify
the maximum size for that table. In addition to that it allows passing
an Error variable.

The function is also renamed and made public since we're going to use
it in other parts of the code.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-03-09 15:17:47 +01:00
..
accounting.c block: make accounting thread-safe 2017-06-16 07:55:00 +08:00
backup.c backup: use copy_bitmap in incremental backup 2017-12-18 10:54:13 -05:00
blkdebug.c block: Switch passthrough drivers to .bdrv_co_block_status() 2018-03-02 18:39:07 +01:00
blkreplay.c block: change variable names in BlockDriverState 2017-06-26 14:54:46 +02:00
blkverify.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
block-backend.c Block layer patches 2018-03-06 11:20:44 +00:00
bochs.c block: Deprecate bdrv_set_read_only() and users 2017-11-17 13:35:59 +01:00
cloop.c block: Deprecate bdrv_set_read_only() and users 2017-11-17 13:35:59 +01:00
commit.c block: Switch passthrough drivers to .bdrv_co_block_status() 2018-03-02 18:39:07 +01:00
crypto.c block: implement the bdrv_reopen_prepare helper for LUKS driver 2018-03-09 15:17:47 +01:00
crypto.h qcow: convert QCow to use QCryptoBlock for encryption 2017-07-11 17:44:56 +02:00
curl.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
dirty-bitmap.c block: maintain persistent disabled bitmaps 2018-02-13 16:59:58 +01:00
dmg-bz2.c dmg: Move libbz2 code to dmg-bz2.so 2016-10-07 14:14:06 +02:00
dmg.c block: Deprecate bdrv_set_read_only() and users 2017-11-17 13:35:59 +01:00
dmg.h block: remove "qemu/osdep.h" from header file 2017-12-18 17:07:02 +03:00
file-posix.c block: rename .bdrv_create() to .bdrv_co_create_opts() 2018-03-02 18:39:07 +01:00
file-win32.c block: rename .bdrv_create() to .bdrv_co_create_opts() 2018-03-02 18:39:07 +01:00
gluster.c block: rename .bdrv_create() to .bdrv_co_create_opts() 2018-03-02 18:39:07 +01:00
io.c block: extract AIO_WAIT_WHILE() from BlockDriverState 2018-03-02 18:39:07 +01:00
iscsi-opts.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
iscsi.c block: convert bdrv_invalidate_cache callback to coroutine_fn 2018-03-09 15:17:47 +01:00
linux-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
Makefile.objs block: Add VFIO based NVMe driver 2018-02-08 09:22:03 +08:00
mirror.c block: Switch passthrough drivers to .bdrv_co_block_status() 2018-03-02 18:39:07 +01:00
nbd-client.c nbd: Honor server's advertised minimum block size 2018-03-01 14:02:32 -06:00
nbd-client.h nbd: Minimal structured read for client 2017-10-30 21:48:41 +01:00
nbd.c Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
nfs.c block: convert bdrv_invalidate_cache callback to coroutine_fn 2018-03-09 15:17:47 +01:00
null.c null: Switch to .bdrv_co_block_status() 2018-03-02 18:39:07 +01:00
nvme.c nvme: Drop pointless .bdrv_co_get_block_status() 2018-03-02 18:39:07 +01:00
parallels.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
parallels.h Clean up includes 2018-02-09 05:05:11 +01:00
qapi.c Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
qcow2-bitmap.c qcow2: fix flushing after dirty bitmap metadata writes 2018-03-09 15:17:47 +01:00
qcow2-cache.c qcow2: Allow configuring the L2 slice size 2018-02-13 17:00:00 +01:00
qcow2-cluster.c qcow2: Replace align_offset() with ROUND_UP() 2018-03-02 18:39:56 +01:00
qcow2-refcount.c qcow2: introduce qcow2_write_caches and qcow2_flush_caches 2018-03-09 15:17:47 +01:00
qcow2-snapshot.c qcow2: Replace align_offset() with ROUND_UP() 2018-03-02 18:39:56 +01:00
qcow2.c qcow2: Generalize validate_table_offset() into qcow2_validate_table() 2018-03-09 15:17:47 +01:00
qcow2.h qcow2: Generalize validate_table_offset() into qcow2_validate_table() 2018-03-09 15:17:47 +01:00
qcow.c block: rename .bdrv_create() to .bdrv_co_create_opts() 2018-03-02 18:39:07 +01:00
qed-check.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
qed-cluster.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-l2-cache.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-table.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
qed.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
qed.h qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
quorum.c Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
raw-format.c block: rename .bdrv_create() to .bdrv_co_create_opts() 2018-03-02 18:39:07 +01:00
rbd.c block: convert bdrv_invalidate_cache callback to coroutine_fn 2018-03-09 15:17:47 +01:00
replication.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
sheepdog.c Block layer patches 2018-03-06 11:20:44 +00:00
snapshot.c Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
ssh.c Block layer patches 2018-03-06 11:20:44 +00:00
stream.c blockjob: remove clock argument from block_job_sleep_ns 2017-11-29 15:11:02 +01:00
throttle-groups.c Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
throttle.c block: Switch passthrough drivers to .bdrv_co_block_status() 2018-03-02 18:39:07 +01:00
trace-events block: Add VFIO based NVMe driver 2018-02-08 09:22:03 +08:00
vdi.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
vhdx-endian.c vhdx: Use QEMU UUID API 2016-09-23 11:42:52 +08:00
vhdx-log.c vhdx: use QEMU_ALIGN_DOWN 2017-08-31 12:29:07 +02:00
vhdx.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
vhdx.h block: vhdx - update PAYLOAD_BLOCK_UNMAPPED value to match 1.00 spec 2014-12-12 15:42:22 +00:00
vmdk.c block: convert bdrv_check callback to coroutine_fn 2018-03-09 15:17:47 +01:00
vpc.c block: rename .bdrv_create() to .bdrv_co_create_opts() 2018-03-02 18:39:07 +01:00
vvfat.c vvfat: Switch to .bdrv_co_block_status() 2018-03-02 18:39:07 +01:00
vxhs.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
win32-aio.c block: explicitly acquire aiocontext in aio callbacks that need it 2017-02-21 11:39:39 +00:00
write-threshold.c Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00