scsi: always zero unused INQUIRY bytes up to 96 if allocated
Our SCSI translation layer only fills 4 version descriptors
meaning the last 30 bytes of the 96 byte standard inquiry
data format are not used. Some compliance tests expect
the full 96 bytes to be returned, even if they are unused.
So zero the remaining bytes (up to 96) if those bytes were
allocated.
This fixes a regression introduced by recent commit d3b58c006
.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id61614b904b5dff39f034b7ba4da624be1b25bae
This commit is contained in:
parent
8aa5539ee4
commit
72bb4b6171
@ -745,6 +745,22 @@ spdk_bdev_scsi_inquiry(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
|
||||
len += 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* We only fill out 4 descriptors, but if the allocation length goes past
|
||||
* that, zero the remaining bytes. This fixes some SCSI compliance tests
|
||||
* which expect a full 96 bytes to be returned, including the unpopulated
|
||||
* version descriptors 5-8 (4 * 2 = 8 bytes) plus the 22 bytes of reserved
|
||||
* space (bytes 74-95) - for a total of 30 bytes.
|
||||
*/
|
||||
if (alloc_len > INQUIRY_OFFSET(reserved) + 8) {
|
||||
i = alloc_len - (INQUIRY_OFFSET(reserved) + 8);
|
||||
if (i > 30) {
|
||||
i = 30;
|
||||
}
|
||||
memset(&inqdata->desc[8], 0, i);
|
||||
len += i;
|
||||
}
|
||||
|
||||
/* ADDITIONAL LENGTH */
|
||||
inqdata->add_len = len;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user