From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRbJG-0001ac-HV for qemu-devel@nongnu.org; Mon, 26 Jan 2009 18:56:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRbJC-0001YT-2a for qemu-devel@nongnu.org; Mon, 26 Jan 2009 18:56:06 -0500 Received: from [199.232.76.173] (port=43447 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRbJB-0001YO-TV for qemu-devel@nongnu.org; Mon, 26 Jan 2009 18:56:01 -0500 Received: from mail2.shareable.org ([80.68.89.115]:39717) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LRbJB-0002Ux-Gu for qemu-devel@nongnu.org; Mon, 26 Jan 2009 18:56:01 -0500 Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from ) id 1LRbJA-0001sG-0m for qemu-devel@nongnu.org; Mon, 26 Jan 2009 23:56:00 +0000 Date: Mon, 26 Jan 2009 23:55:59 +0000 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH] fix sector overflow for scsi disks >1TB large Message-ID: <20090126235559.GD9296@shareable.org> References: <20090126174209.1690ef05@bree.surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090126174209.1690ef05@bree.surriel.com> 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 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. -- JAmie