public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Patrick Mansfield <patmans@us.ibm.com>,
	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: Mon, 30 Oct 2006 17:32:16 +0100	[thread overview]
Message-ID: <45462910.1090409@s5r6.in-berlin.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0610301017020.6233-100000@iolanthe.rowland.org>

Alan Stern wrote:
> +	int copy_len;
...
> +	copy_len = max((int) sdev->inquiry_len, 36);
> +	sdev->inquiry = kmalloc(copy_len, GFP_ATOMIC);
>  	if (sdev->inquiry == NULL) {
>  		return SCSI_SCAN_NO_RESPONSE;
>  	}
...
> +	memcpy(sdev->inquiry, inq_result, copy_len);
...

Can be written slightly more concise:

	sdev->inquiry = kmemdup(inq_result,
				max_t(size_t, sdev->inquiry_len, 36),
				GFP_ATOMIC);
	if (sdev->inquiry == NULL)
		return SCSI_SCAN_NO_RESPONSE;

This is untested. kmemdup is only available since 2.6.19-rc1.
-- 
Stefan Richter
-=====-=-==- =-=- ====-
http://arcgraph.de/sr/

  reply	other threads:[~2006-10-30 16:32 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
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 [this message]
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=45462910.1090409@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=patmans@us.ibm.com \
    --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