From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRqCF-000300-97 for qemu-devel@nongnu.org; Tue, 27 Jan 2009 10:49:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRqCD-0002yu-KY for qemu-devel@nongnu.org; Tue, 27 Jan 2009 10:49:50 -0500 Received: from [199.232.76.173] (port=56300 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRqCD-0002yr-Hh for qemu-devel@nongnu.org; Tue, 27 Jan 2009 10:49:49 -0500 Received: from mx2.redhat.com ([66.187.237.31]:39848) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LRqCD-0003G5-2t for qemu-devel@nongnu.org; Tue, 27 Jan 2009 10:49:49 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0RFnm2N025603 for ; Tue, 27 Jan 2009 10:49:48 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0RFnman032019 for ; Tue, 27 Jan 2009 10:49:48 -0500 Received: from bree.surriel.com (vpn-10-44.bos.redhat.com [10.16.10.44]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0RFnkGu014096 for ; Tue, 27 Jan 2009 10:49:48 -0500 Message-ID: <497F2D18.5010107@redhat.com> Date: Tue, 27 Jan 2009 10:49:44 -0500 From: Rik van Riel MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] fix sector overflow for scsi disks >1TB large References: <20090126174209.1690ef05@bree.surriel.com> <20090126235559.GD9296@shareable.org> In-Reply-To: <20090126235559.GD9296@shareable.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Jamie Lokier wrote: > Rik van Riel wrote: >> @@ -50,7 +50,7 @@ >> /* ??? We should probably keep track of whether the data trasfer is > > Not your fault, but I just noticed a typo: "trasfer" :-) > >> if (nb_sectors) { >> nb_sectors--; >> + /* Clip to 2TB, instead of returning capacity modulo 2TB. */ >> + if (nb_sectors > UINT_MAX) >> + nb_sectors = UINT_MAX; >> outbuf[0] = (nb_sectors >> 24) & 0xff; >> outbuf[1] = (nb_sectors >> 16) & 0xff; >> outbuf[2] = (nb_sectors >> 8) & 0xff; > > Wouldn't it be clearer andd safer to say 0xffffffff here, or UINT32_MAX? > > I know QEMU only runs on hosts with 32-bit unsigned int, and perhaps > that will always be truea, but it's a bit unnecessary to assume it here. Neither of your suggested changes hurts one bit, so I'll send in a new patch :) -- All rights reversed.