From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] support >2TB SCSI disks
Date: Wed, 28 Jan 2009 12:30:28 +0000 [thread overview]
Message-ID: <200901281230.29455.paul@codesourcery.com> (raw)
In-Reply-To: <20090127224619.3ae16173@bree.surriel.com>
> 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.
> 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.
We should to implement the Block Limits VPD page, and enforce these limits.
> + /* 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.
Paul
next prev parent reply other threads:[~2009-01-28 12:30 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 [this message]
2009-01-28 14:13 ` Rik van Riel
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=200901281230.29455.paul@codesourcery.com \
--to=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.