From: Christoph Hellwig <hch@infradead.org>
To: Hannes Reinecke <hare@suse.de>
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 06:15:34 -0800 [thread overview]
Message-ID: <20140210141534.GA17671@infradead.org> (raw)
In-Reply-To: <1392030699-105348-1-git-send-email-hare@suse.de>
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?
next prev parent reply other threads:[~2014-02-10 14:15 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 [this message]
2014-02-10 14:55 ` Hannes Reinecke
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=20140210141534.GA17671@infradead.org \
--to=hch@infradead.org \
--cc=dgilbert@interlog.com \
--cc=hare@suse.de \
--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 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.