qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity request


From: Christoph Hellwig
Subject: [Qemu-devel] [PATCH] fix bdrv_check_request for byte-granularity requests
Date: Sat, 14 Mar 2009 14:00:03 +0100
User-agent: Mutt/1.3.28i

We never allow the offset to be byte-granularity for the sector-based
interface, instead the negative value for byte values applied to the
request length.


Signed-off-by: Christoph Hellwig <address@hidden>

Index: qemu/block.c
===================================================================
--- qemu.orig/block.c   2009-03-11 11:50:27.000000000 +0100
+++ qemu/block.c        2009-03-11 11:51:42.000000000 +0100
@@ -542,15 +542,15 @@ static int bdrv_check_byte_request(Block
 static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num,
                               int nb_sectors)
 {
-    int64_t offset;
+    size_t len;
 
     /* Deal with byte accesses */
-    if (sector_num < 0)
-        offset = -sector_num;
+    if (nb_sectors < 0)
+        len = -nb_sectors;
     else
-        offset = sector_num * 512;
+        len = nb_sectors * 512;
 
-    return bdrv_check_byte_request(bs, offset, nb_sectors * 512);
+    return bdrv_check_byte_request(bs, sector_num * 512, len);
 }
 
 /* return < 0 if error. See bdrv_write() for the return codes */




reply via email to

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