qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fix sector overflow for scsi disks >1TB large


From: Rik van Riel
Subject: Re: [Qemu-devel] [PATCH] fix sector overflow for scsi disks >1TB large
Date: Tue, 27 Jan 2009 10:49:44 -0500
User-agent: Thunderbird 2.0.0.17 (X11/20080915)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]