From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
James Bottomley <james.bottomley@hansenpartnership.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Hannes Reinecke <hare@suse.com>
Subject: [PATCH] scsi_devinfo: fixup string compare
Date: Fri, 4 Aug 2017 11:40:25 +0200 [thread overview]
Message-ID: <1501839625-93492-1-git-send-email-hare@suse.de> (raw)
When checking the model and vendor string we need to use the
minimum value of either string, otherwise we'll miss out on
wildcard matches.
Without this patch certain Hitachi arrays will not be presenting
VPD pages correctly.
Fixes: 5e7ff2c ("SCSI: fix new bug in scsi_dev_info_list string matching")
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/scsi_devinfo.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 28fea83..f8a302f 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -456,11 +456,13 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
/*
* Behave like the older version of get_device_flags.
*/
- if (memcmp(devinfo->vendor, vskip, vmax) ||
+ if (memcmp(devinfo->vendor, vskip,
+ min(vmax, strlen(devinfo->vendor))) ||
(vmax < sizeof(devinfo->vendor) &&
devinfo->vendor[vmax]))
continue;
- if (memcmp(devinfo->model, mskip, mmax) ||
+ if (memcmp(devinfo->model, mskip,
+ min(mmax, strlen(devinfo->model))) ||
(mmax < sizeof(devinfo->model) &&
devinfo->model[mmax]))
continue;
--
1.8.5.6
next reply other threads:[~2017-08-04 9:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-04 9:40 Hannes Reinecke [this message]
2017-08-04 15:32 ` [PATCH] scsi_devinfo: fixup string compare Bart Van Assche
2017-08-04 16:28 ` Hannes Reinecke
2017-08-04 16:38 ` Bart Van Assche
2017-08-08 14:28 ` Hannes Reinecke
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=1501839625-93492-1-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--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