From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, hch@lst.de
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 4/6] scsi: Fix VPD page wrapper
Date: Thu, 19 Aug 2010 11:48:59 -0400 [thread overview]
Message-ID: <1282232941-9910-5-git-send-email-martin.petersen@oracle.com> (raw)
In-Reply-To: <1282232941-9910-1-git-send-email-martin.petersen@oracle.com>
Fix two bugs in the VPD page wrapper:
- Don't return failure if the user asked for page 0
- The end of buffer check failed to account for the page header size
and consequently didn't work
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
drivers/scsi/scsi.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index ad0ed21..348fba0 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1046,13 +1046,13 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
/* If the user actually wanted this page, we can skip the rest */
if (page == 0)
- return -EINVAL;
+ return 0;
for (i = 0; i < min((int)buf[3], buf_len - 4); i++)
if (buf[i + 4] == page)
goto found;
- if (i < buf[3] && i > buf_len)
+ if (i < buf[3] && i >= buf_len - 4)
/* ran off the end of the buffer, give us benefit of doubt */
goto found;
/* The device claims it doesn't support the requested page */
--
1.7.2.1
next prev parent reply other threads:[~2010-08-19 15:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-19 15:48 Discard/trim/thin provisioning update Martin K. Petersen
2010-08-19 15:48 ` [PATCH 1/6] libata: Signal that our SATL supports WRITE SAME(16) with UNMAP Martin K. Petersen
2010-08-19 16:15 ` James Bottomley
2010-08-19 16:20 ` Martin K. Petersen
2010-08-23 8:32 ` Tejun Heo
2010-08-23 18:22 ` Douglas Gilbert
2010-08-23 18:29 ` Douglas Gilbert
2010-08-23 19:11 ` Martin K. Petersen
2010-08-19 15:48 ` [PATCH 2/6] libata: Report supported TRIM payload size Martin K. Petersen
2010-08-19 17:27 ` Greg Freemyer
2010-08-19 18:05 ` Martin K. Petersen
2010-08-19 21:08 ` Greg Freemyer
2010-08-19 21:50 ` Mark Lord
2010-08-20 8:58 ` Christoph Hellwig
2010-08-20 13:53 ` Mark Lord
2010-08-20 17:13 ` Greg Freemyer
2010-08-20 18:28 ` Mark Lord
2010-08-23 13:50 ` Christoph Hellwig
2010-08-23 18:56 ` Martin K. Petersen
2010-08-19 15:48 ` [PATCH 3/6] block: Make max_discard_sectors sector_t Martin K. Petersen
2010-08-20 8:59 ` Christoph Hellwig
2010-08-19 15:48 ` Martin K. Petersen [this message]
2010-08-19 15:49 ` [PATCH 5/6] scsi_debug: Update thin provisioning support Martin K. Petersen
2010-08-23 16:37 ` Douglas Gilbert
2010-08-19 15:49 ` [PATCH 6/6] sd: " Martin K. Petersen
2010-08-20 9:00 ` Christoph Hellwig
2010-08-23 19:06 ` Martin K. Petersen
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=1282232941-9910-5-git-send-email-martin.petersen@oracle.com \
--to=martin.petersen@oracle.com \
--cc=hch@lst.de \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).