From: Matthew Wilcox <matthew@wil.cx>
To: Bart Van Assche <bart.vanassche@gmail.com>
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 12:04:13 -0700 [thread overview]
Message-ID: <20091209190413.GB7246@parisc-linux.org> (raw)
In-Reply-To: <200912091952.19978.bart.vanassche@gmail.com>
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;
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
next prev parent reply other threads:[~2009-12-09 19:04 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 [this message]
2009-12-09 19:17 ` Bart Van Assche
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=20091209190413.GB7246@parisc-linux.org \
--to=matthew@wil.cx \
--cc=James.Bottomley@suse.de \
--cc=bart.vanassche@gmail.com \
--cc=brking@linux.vnet.ibm.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-scsi@vger.kernel.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.