public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
	SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] SCSI: sanitize INQUIRY strings
Date: Mon, 21 Aug 2006 12:42:44 -0600	[thread overview]
Message-ID: <20060821184244.GC24068@parisc-linux.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0608211412010.8319-100000@iolanthe.rowland.org>

On Mon, Aug 21, 2006 at 02:31:18PM -0400, Alan Stern wrote:
> I assumed the point of those optimizations was obvious enough not to need 
> any comment.

Bad assumption.  When you say "This is what the patch does", then I
assume the whole patch does that.  When you say "The patch does X, and
by the way, does some other minor cleanups", then I know the bits which
make no sense are the cleanups and not needed for X.

> (It is still present according to the web interface to the 
> scsi-misc repository on www.kernel.org, BTW.)

It's not ...
http://git.kernel.org/git/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=blob;h=a24d3461fc788b797f492cfff333fa419e9f3bc3;hb=d2afb3ae04e36dbc6e9eb2d8bd54406ff7b6b3bd;f=drivers/scsi/scsi_scan.c

I took it out with:
http://git.kernel.org/git/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commitdiff;h=4ff36718ede26ee2da73f2dae94d71e2b06845fc

> Besides, let's assume you're right and the vendor really did mean to 
> terminate the string by putting a NUL there.  The bytes following the 
> NUL could be anything, but most likely the vendor would set them to more 
> NULs or to spaces.  So the patch would change those NULs to spaces, and 
> the result is you end up with exactly the string the vendor intended, 
> except now it is padded with spaces to the correct length as required by 
> the spec.

My suggestion produced the same result as yours for these cases.

> On the other hand, if some of the characters following the NUL happen to 
> be printable then the patch does change the meaning of the string.  That's 
> inevitable; when vendors don't follow the rules then sometimes they will 
> be misunderstood.  Who's to say whether the pre-patch interpretation is 
> any better than the post-patch interpretation?

I say so.  I gave an example where my algorithm produces better results
than yours in my response to Philip Auld.  Do you have an example where
yours gives preferable results?

  reply	other threads:[~2006-08-21 18:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-21 16:03 [PATCH] SCSI: sanitize INQUIRY strings Alan Stern
2006-08-21 16:14 ` Matthew Wilcox
2006-08-21 16:52   ` Alan Stern
2006-08-21 17:35     ` Matthew Wilcox
2006-08-21 18:11       ` Philip R. Auld
2006-08-21 18:27         ` Matthew Wilcox
2006-08-21 18:51           ` Philip R. Auld
2006-08-21 19:11             ` Alan Stern
2006-08-21 19:53           ` Alan Stern
2006-08-21 18:31       ` Alan Stern
2006-08-21 18:42         ` Matthew Wilcox [this message]
2006-08-21 19:08           ` Alan Stern

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=20060821184244.GC24068@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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