qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 3/3] block: enforce constraints on block size pro


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PATCH v2 3/3] block: enforce constraints on block size properties
Date: Wed, 14 Mar 2012 15:57:06 +0000

Nicolae Mogoreanu <address@hidden> 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 <address@hidden>
Reported-by: Michael Halcrow <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
 block.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/block.h b/block.h
index 415bb17..3df6c30 100644
--- a/block.h
+++ b/block.h
@@ -437,10 +437,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),        \
-- 
1.7.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]