From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WC4bS-0003Ro-5I for qemu-devel@nongnu.org; Sat, 08 Feb 2014 04:53:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WC4bM-0001kA-5z for qemu-devel@nongnu.org; Sat, 08 Feb 2014 04:53:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WC4bL-0001k6-UK for qemu-devel@nongnu.org; Sat, 08 Feb 2014 04:53:32 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s189rU7B030214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 8 Feb 2014 04:53:31 -0500 Message-ID: <52F5FE98.1030505@redhat.com> Date: Sat, 08 Feb 2014 10:53:28 +0100 From: Laszlo Ersek MIME-Version: 1.0 References: <1391852864-11969-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1391852864-11969-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block: Fix 32 bit truncation in mark_request_serialising() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, stefanha@redhat.com On 02/08/14 10:47, Kevin Wolf wrote: > 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: Kevin Wolf > --- > block.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/block.c b/block.c > index b0c5025..636aa11 100644 > --- a/block.c > +++ b/block.c > @@ -2240,11 +2240,11 @@ static void tracked_request_begin(BdrvTrackedRequest *req, > 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); > - int overlap_bytes = ROUND_UP(req->offset + req->bytes, align) > - - overlap_offset; > + unsigned int overlap_bytes = ROUND_UP(req->offset + req->bytes, align) > + - overlap_offset; > > if (!req->serialising) { > req->bs->serialising_in_flight++; > Reviewed-by: Laszlo Ersek Thanks! Laszlo