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@xxxxxxxx> --- 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