cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-Fix-32-bit-truncation-in-mark_request_serialis.patch

0a122b
From 68dbc9269577747455be55f209066926d1994d3c Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Sat, 8 Feb 2014 10:42:18 +0100
0a122b
Subject: [PATCH 22/37] block: Fix 32 bit truncation in mark_request_serialising()
0a122b
0a122b
Message-id: <1392117622-28812-23-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 57187
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 22/37] block: Fix 32 bit truncation in mark_request_serialising()
0a122b
Bugzilla: 748906
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
0a122b
0a122b
On 32 bit hosts, size_t is too small for align as the bitmask
0a122b
~(align - 1) will zero out the higher 32 bits of the offset.
0a122b
0a122b
While at it, change the local overlap_bytes variable to unsigned to
0a122b
match the field in BdrvTrackedRequest.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 block.c | 6 +++---
0a122b
 1 file changed, 3 insertions(+), 3 deletions(-)
0a122b
---
0a122b
 block.c |    6 +++---
0a122b
 1 files changed, 3 insertions(+), 3 deletions(-)
0a122b
0a122b
diff --git a/block.c b/block.c
0a122b
index 24e94e6..94fd702 100644
0a122b
--- a/block.c
0a122b
+++ b/block.c
0a122b
@@ -2088,11 +2088,11 @@ static void tracked_request_begin(BdrvTrackedRequest *req,
0a122b
     QLIST_INSERT_HEAD(&bs->tracked_requests, req, list);
0a122b
 }
0a122b
 
0a122b
-static void mark_request_serialising(BdrvTrackedRequest *req, size_t align)
0a122b
+static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align)
0a122b
 {
0a122b
     int64_t overlap_offset = req->offset & ~(align - 1);
0a122b
-    int overlap_bytes = ROUND_UP(req->offset + req->bytes, align)
0a122b
-                      - overlap_offset;
0a122b
+    unsigned int overlap_bytes = ROUND_UP(req->offset + req->bytes, align)
0a122b
+                               - overlap_offset;
0a122b
 
0a122b
     if (!req->serialising) {
0a122b
         req->bs->serialising_in_flight++;
0a122b
-- 
0a122b
1.7.1
0a122b