From: Bart Van Assche <bart.vanassche@gmail.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-scsi@vger.kernel.org,
"James E.J. Bottomley" <James.Bottomley@suse.de>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Brian King <brking@linux.vnet.ibm.com>
Subject: Re: [PATCH] SCSI/libsrp: fix bug in ADDITIONAL CDB LENGTH interpretation
Date: Wed, 9 Dec 2009 20:17:16 +0100 [thread overview]
Message-ID: <e2e108260912091117n59240ae5kea36022313f9ef93@mail.gmail.com> (raw)
In-Reply-To: <20091209190413.GB7246@parisc-linux.org>
On Wed, Dec 9, 2009 at 8:04 PM, Matthew Wilcox <matthew@wil.cx> wrote:
>
> On Wed, Dec 09, 2009 at 07:52:19PM +0100, Bart Van Assche wrote:
> > Fix a bug in the interpretation of the ADDITIONAL CDB LENGTH (add_cdb_len)
> > field of SRP_CMD requests. According to the SRP specification, the layout
> > of this single-byte field is as follows:
> > * Bits 0 and 1 are reserved.
> > * Bits 2 to 7 represent the ADDITIONAL CDB LENGTH field, symbolically
> > represented as n.
> > * Still according to the SRP specification, the ADDITIONAL CDB section
> > takes 4*n bytes.
>
> Your interpretation of the SRP spec does seem to be correct, and I can
> totally see how the original author of this code got it wrong.
>
> > - offset = cmd->add_cdb_len * 4;
> > + offset = (cmd->add_cdb_len >> 2) * 4;
>
> Would this not be better written as:
>
> offset = cmd->add_cdb_len & ~3;
I chose the former because of better readability for someone familiar
with the specs. But I do not have a strong opinion about this -- more
opinions are welcome.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-12-09 19:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-09 18:52 [PATCH] SCSI/libsrp: fix bug in ADDITIONAL CDB LENGTH interpretation Bart Van Assche
2009-12-09 19:04 ` Matthew Wilcox
2009-12-09 19:17 ` Bart Van Assche [this message]
2009-12-09 23:37 ` FUJITA Tomonori
2010-01-19 7:04 ` Bart Van Assche
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=e2e108260912091117n59240ae5kea36022313f9ef93@mail.gmail.com \
--to=bart.vanassche@gmail.com \
--cc=James.Bottomley@suse.de \
--cc=brking@linux.vnet.ibm.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).