From 1f900054e18a949eff4781e62025f1082774f631 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Wed, 13 Aug 2014 18:53:52 +0200 Subject: [PATCH] test-tool: fix Inquiry.AllocLength according to SBC-2 the alloc length should be at least 5 when evpd is set to zero. Also don't leak task if SPC-3 or later. Signed-off-by: Peter Lieven --- test-tool/test_inquiry_alloc_length.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test-tool/test_inquiry_alloc_length.c b/test-tool/test_inquiry_alloc_length.c index 5076d74..0d761cd 100644 --- a/test-tool/test_inquiry_alloc_length.c +++ b/test-tool/test_inquiry_alloc_length.c @@ -35,8 +35,8 @@ test_inquiry_alloc_length(void) logging(LOG_VERBOSE, "Test of the INQUIRY allocation length"); - logging(LOG_VERBOSE, "Verify we can read standard INQUIRY page with alloc length from 0-255"); - for (i = 0; i < 256 ; i++) { + logging(LOG_VERBOSE, "Verify we can read standard INQUIRY page with alloc length from 5-255"); + for (i = 5; i < 256 ; i++) { if (task != NULL) { scsi_free_scsi_task(task); task = NULL; @@ -78,6 +78,9 @@ test_inquiry_alloc_length(void) goto finished; } + scsi_free_scsi_task(task); + task = NULL; + logging(LOG_VERBOSE, "Version is SPC-3 or later. Read INQUIRY data using 16-bit allocation length"); logging(LOG_VERBOSE, "Read INQUIRY data with allocation length 511 (low order byte is 0xff)"); ret = inquiry(iscsic, tgt_lun, 0, 0, 511, &task);