提交 e96126ff 编写于 作者: K Kevin Wolf

block: Fix 32 bit truncation in mark_request_serialising()

On 32 bit hosts, size_t is too small for align as the bitmask
~(align - 1) will zero out the higher 32 bits of the offset.

While at it, change the local overlap_bytes variable to unsigned to
match the field in BdrvTrackedRequest.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
上级 eaf944a4
...@@ -2240,11 +2240,11 @@ static void tracked_request_begin(BdrvTrackedRequest *req, ...@@ -2240,11 +2240,11 @@ static void tracked_request_begin(BdrvTrackedRequest *req,
QLIST_INSERT_HEAD(&bs->tracked_requests, req, list); QLIST_INSERT_HEAD(&bs->tracked_requests, req, list);
} }
static void mark_request_serialising(BdrvTrackedRequest *req, size_t align) static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align)
{ {
int64_t overlap_offset = req->offset & ~(align - 1); int64_t overlap_offset = req->offset & ~(align - 1);
int overlap_bytes = ROUND_UP(req->offset + req->bytes, align) unsigned int overlap_bytes = ROUND_UP(req->offset + req->bytes, align)
- overlap_offset; - overlap_offset;
if (!req->serialising) { if (!req->serialising) {
req->bs->serialising_in_flight++; req->bs->serialising_in_flight++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册