From: Rik van Riel <riel@redhat.com>
To: Paul Brook <paul@codesourcery.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] support >2TB SCSI disks
Date: Wed, 28 Jan 2009 09:13:37 -0500 [thread overview]
Message-ID: <49806811.4070407@redhat.com> (raw)
In-Reply-To: <200901281230.29455.paul@codesourcery.com>
Paul Brook wrote:
>> case 0:
>> - lba = buf[3] | (buf[2] << 8) | ((buf[1] & 0x1f) << 16);
>> + lba = (uint64_t) buf[3] | ((uint64_t) buf[2] << 8) |
>> + (((uint64_t) buf[1] & 0x1f) << 16);
>
> This is not required, though I guess it's harmless.
I thought I'd keep them all consistent :)
>> case 4:
>> ...
>> len = buf[13] | (buf[12] << 8) | (buf[11] << 16) | (buf[10] << 24);
>> ...
>> + case 0x88:
>> r->sector_count = len * s->cluster_size;
>
> Implementing these commands introduces several overflows. There are several
> places (including SCSIRequest->sector_count and the return value from
> scsi_send_comand) that assume the transfer length fits in a signed (32-bit)
> int.
True, a SCSI transfer of more than 2GB would cause an overflow.
>> + /* Returned value is the address of the last sector. */
>> + if (nb_sectors) {
>> + nb_sectors--;
>
> By my reading both this and the current Read Capacity(10) are incorrect.
> They need to divide by s->cluster_size.
Good point. Want me to send in a separate patch that does that?
--
All rights reversed.
next prev parent reply other threads:[~2009-01-28 14:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 3:46 [Qemu-devel] [PATCH] support >2TB SCSI disks Rik van Riel
2009-01-28 12:30 ` Paul Brook
2009-01-28 14:13 ` Rik van Riel [this message]
2009-01-28 16:28 ` M. Warner Losh
2009-01-29 15:04 ` Paul Brook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49806811.4070407@redhat.com \
--to=riel@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.