aboutsummaryrefslogtreecommitdiff
path: root/block.h
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-03-14 15:57:06 +0000
committerKevin Wolf <kwolf@redhat.com>2012-04-05 14:54:40 +0200
commit1fc86bf963a0617bc9eabfa6c14dbca76cd57976 (patch)
tree25d43bed8c5b7b2e02dd8d275145d252455e31ed /block.h
parent02fda01c3024463e561820afb0ba09daba4014d9 (diff)
downloadqemu-1fc86bf963a0617bc9eabfa6c14dbca76cd57976.zip
qemu-1fc86bf963a0617bc9eabfa6c14dbca76cd57976.tar.gz
qemu-1fc86bf963a0617bc9eabfa6c14dbca76cd57976.tar.bz2
block: enforce constraints on block size properties
Nicolae Mogoreanu <mogo@google.com> noticed that I/O requests can lead to QEMU crashes when the logical_block_size property is smaller than 512 bytes. Using the new "blocksize" property we can properly enforce constraints on the block size such that QEMU's block layer is able to operate correctly. Reported-by: Nicolae Mogoreanu <mogo@google.com> Reported-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.h')
-rw-r--r--block.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/block.h b/block.h
index e670606..c51ab16 100644
--- a/block.h
+++ b/block.h
@@ -435,10 +435,10 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
#define DEFINE_BLOCK_PROPERTIES(_state, _conf) \
DEFINE_PROP_DRIVE("drive", _state, _conf.bs), \
- DEFINE_PROP_UINT16("logical_block_size", _state, \
- _conf.logical_block_size, 512), \
- DEFINE_PROP_UINT16("physical_block_size", _state, \
- _conf.physical_block_size, 512), \
+ DEFINE_PROP_BLOCKSIZE("logical_block_size", _state, \
+ _conf.logical_block_size, 512), \
+ DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \
+ _conf.physical_block_size, 512), \
DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \
DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \
DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \