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

[Xen-changelog] [qemu-xen master] raw_bsd: don't check size alignment when only offset is set



commit 80a15e3e2eed96926d886693663503985c9a98bb
Author:     Tomáš Golembiovský <tgolembi@xxxxxxxxxx>
AuthorDate: Thu Nov 3 14:47:49 2016 +0100
Commit:     Kevin Wolf <kwolf@xxxxxxxxxx>
CommitDate: Fri Nov 11 15:54:55 2016 +0100

    raw_bsd: don't check size alignment when only offset is set
    
    We make sure that the size is aligned to sector length to prevent any
    round ups. Otherwise we could end up reading/writing data outside the
    area specified by user. This is only needed when user supplies the size
    option to avoid any surprises. It is not necessary when only offset is
    set.
    
    More over, the check made it difficult to use the offset option without
    size option. The check puts unneeded restriction on the offset which had
    to be aligned too. Because bdrv_getlength() returns aligned value having
    unaligned offset would make the check fail.
    
    Signed-off-by: Tomáš Golembiovský <tgolembi@xxxxxxxxxx>
    Signed-off-by: Kevin Wolf <kwolf@xxxxxxxxxx>
---
 block/raw_bsd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/raw_bsd.c b/block/raw_bsd.c
index cf7a560..8a5b9b0 100644
--- a/block/raw_bsd.c
+++ b/block/raw_bsd.c
@@ -119,7 +119,7 @@ static int raw_read_options(QDict *options, 
BlockDriverState *bs,
 
     /* Make sure size is multiple of BDRV_SECTOR_SIZE to prevent rounding
      * up and leaking out of the specified area. */
-    if (!QEMU_IS_ALIGNED(s->size, BDRV_SECTOR_SIZE)) {
+    if (s->has_size && !QEMU_IS_ALIGNED(s->size, BDRV_SECTOR_SIZE)) {
         error_setg(errp, "Specified size is not multiple of %llu",
             BDRV_SECTOR_SIZE);
         ret = -EINVAL;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.