When passing LUN IDs through treat ASCII values as fixed-length, not
interpreating NULLs as EOLs, but converting them to spaces. SPC-4 does not tell that T10-based IDs should be NULL-terminated/padded. And while it tells that it should include only ASCII chars (0x20-0x7F), there are some USB sticks (SanDisk Ultra Fit), that have NULLs inside the value. Treating NULLs as EOLs there made those LUN IDs non-unique. MFC after: 1 week
This commit is contained in:
parent
15ad7a7c39
commit
fa91cabfbd
@ -1136,8 +1136,15 @@ xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path)
|
||||
if (idd == NULL)
|
||||
goto out;
|
||||
ret = 0;
|
||||
if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII ||
|
||||
(idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) {
|
||||
if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_ASCII) {
|
||||
if (idd->length < len) {
|
||||
for (l = 0; l < idd->length; l++)
|
||||
buf[l] = idd->identifier[l] ?
|
||||
idd->identifier[l] : ' ';
|
||||
buf[l] = 0;
|
||||
} else
|
||||
ret = EFAULT;
|
||||
} else if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == SVPD_ID_CODESET_UTF8) {
|
||||
l = strnlen(idd->identifier, idd->length);
|
||||
if (l < len) {
|
||||
bcopy(idd->identifier, buf, l);
|
||||
|
Loading…
Reference in New Issue
Block a user