public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: James Bottomley <jbottomley@parallels.com>,
	linux-scsi@vger.kernel.org, Jeremy Linton <jlinton@tributary.com>,
	Doug Gilbert <dgilbert@interlog.com>,
	Kai Makisara <kai.makisara@kolumbus.fi>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCHv2] Add EVPD page 0x83 entries to sysfs
Date: Mon, 10 Feb 2014 15:55:08 +0100	[thread overview]
Message-ID: <52F8E84C.60602@suse.de> (raw)
In-Reply-To: <20140210141534.GA17671@infradead.org>

On 02/10/2014 03:15 PM, Christoph Hellwig wrote:
> On Mon, Feb 10, 2014 at 12:11:39PM +0100, Hannes Reinecke wrote:
>> +	int vpd_len = 255;
>> +	unsigned char *buffer;
>> +retry:
>> +	buffer = kmalloc(vpd_len, GFP_KERNEL);
>> +	if (!buffer)
>> +		return;
>> +
>> +	ret = scsi_get_vpd_page(sdev, 0x83, buffer, vpd_len);
>> +	if (ret) {
>> +		kfree(buffer);
>> +		return;
>> +	}
>> +
>> +	vpd_len = (buffer[2] << 8) + buffer[3];
>> +	if (vpd_len > 255) {
>> +		kfree(buffer);
>> +		goto retry;
> 
> Won't this create an infinite loop if the VPD is longer than 255 bytes?
> 
Hmm. Sort of.

Gnaa.

Will be redoing the patch.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
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

  reply	other threads:[~2014-02-10 14:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 11:11 [PATCHv2] Add EVPD page 0x83 entries to sysfs Hannes Reinecke
2014-02-10 14:15 ` Christoph Hellwig
2014-02-10 14:55   ` Hannes Reinecke [this message]
2014-02-10 18:06 ` Jeremy Linton
2014-02-10 19:06   ` Douglas Gilbert
2014-02-11 10:52     ` Hannes Reinecke
2014-02-11  8:32   ` Hannes Reinecke
2014-02-11 16:56     ` Jeremy Linton

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=52F8E84C.60602@suse.de \
    --to=hare@suse.de \
    --cc=dgilbert@interlog.com \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=jlinton@tributary.com \
    --cc=kai.makisara@kolumbus.fi \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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