public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
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 core: always store >= 36 bytes of INQUIRY data
Date: Fri, 27 Oct 2006 14:43:43 -0700	[thread overview]
Message-ID: <20061027214343.GA1701@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0610261709360.9684-100000@iolanthe.rowland.org>

On Thu, Oct 26, 2006 at 05:11:27PM -0400, Alan Stern wrote:
> This patch (as810) sets the length of the INQUIRY data to a minimum of
> 36 bytes, even if the device claims that not all of them are valid.
> Using the data sent by the device is better than allocating a short
> buffer and then reading beyond the end of it, which is what we do now.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> 
> ---
> 
> Index: usb-2.6/drivers/scsi/scsi_scan.c
> ===================================================================
> --- usb-2.6.orig/drivers/scsi/scsi_scan.c
> +++ usb-2.6/drivers/scsi/scsi_scan.c
> @@ -575,6 +575,19 @@ static int scsi_probe_lun(struct scsi_de
>  	 * short INQUIRY), an abort here prevents any further use of the
>  	 * device, including spin up.
>  	 *
> +	 * On the whole, the best approach seems to be to assume the first
> +	 * 36 bytes are valid no matter what the device says.  That's

The comment is confusing, as it implies the device will modify data past
the indicated length, but well behaved devices should not do that, and
with your patch should point to zero filled data.

Just comment on what its avoiding or such like:

	Modify short inquiry_len values so we don't later point at random
	values. Devices returning an incorrect value in the INQUIRY
	additional length field will point at potentially valid data for
	Vendor, Product and Revsion, while conforming devices will point
	to zero filled data.

But definitely better to use possibly valid data for broken devices or
NUL for well behaved devices rather than garbage values.

> +	 * better than copying < 36 bytes to the inquiry-result buffer
> +	 * and displaying garbage for the Vendor, Product, and Revision
> +	 * strings.
> +	 */
> +	if (sdev->inquiry_len < 36) {
> +		printk(KERN_INFO "scsi scan: INQUIRY result too short (%d),"
> +				" using 36\n", sdev->inquiry_len);
> +		sdev->inquiry_len = 36;
> +	}
> +
> +	/*

-- Patrick Mansfield

  reply	other threads:[~2006-10-27 21:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-26 21:11 [PATCH] SCSI core: always store >= 36 bytes of INQUIRY data Alan Stern
2006-10-27 21:43 ` Patrick Mansfield [this message]
2006-10-27 22:10   ` Douglas Gilbert
2006-10-28 15:41     ` Alan Stern
2006-10-30 16:40       ` Douglas Gilbert
2006-10-28 15:33   ` Alan Stern
2006-10-28 18:30     ` Patrick Mansfield
2006-10-30 15:20   ` Alan Stern
2006-10-30 16:32     ` Stefan Richter
2006-10-31 21:26       ` 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=20061027214343.GA1701@us.ibm.com \
    --to=patmans@us.ibm.com \
    --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