On Tue, 8 Aug 2017, Hannes Reinecke wrote:
> 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.
> And we should avoid matching anything with zero size as this
> match will be incorrect.
> 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 <h...@suse.com>
This is very questionable. As described in commit b704f70ce200 ("SCSI:
fix bug in scsi_dev_info_list matching"), there are devices which have
vendor or model strings of length 0, and there are entries in the
global device list like that too. With this patch, such devices and
such entries would never match anything.
Also, the idea of using the minimum length of either string doesn't
sound right. It would allow a device with string "abc" to match an
entry in the list with string "abcd", which would be wrong.
Allow a device string to match a list entry if the lengths
are equal or the list entry is shorter (this would be a
wildcard match), but not if the list entry is longer. Here
the device string length is after leading and trailing blanks
have been removed.
As a corollary, allow an empty device string to match an empty
list entry but nothing else.