From b3783b961b00b942e63ab2e00ca2db32302e3563 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 10 Apr 2015 17:52:20 +0200 Subject: [PATCH] test-tool: Avoid that Valgrind complains about uninitialized data Avoid that Valgrind reports complaints similar to the following: Syscall param writev(vector[...]) points to uninitialised byte(s) at 0x5567087: writev (writev.c:49) by 0x5265AE0: iscsi_iovector_readv_writev (socket.c:492) by 0x52666B5: iscsi_write_to_socket (socket.c:710) by 0x5266CCC: iscsi_service (socket.c:852) by 0x526751F: event_loop (sync.c:67) by 0x5269B41: iscsi_scsi_command_sync (sync.c:1153) by 0x4050F6: send_scsi_command (iscsi-support.c:245) by 0x408007: compareandwrite (iscsi-support.c:1512) by 0x40B6AD: test_compareandwrite_dpofua (test_compareandwrite_dpofua.c:69) by 0x503EC99: ??? (in /usr/lib/libcunit.so.1.0.1) by 0x503EF27: ??? (in /usr/lib/libcunit.so.1.0.1) by 0x503F2A5: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1) Address 0xffeffff10 is on thread 1's stack in frame #8, created by test_compareandwrite_dpofua (test_compareandwrite_dpofua.c:30) Signed-off-by: Bart Van Assche --- test-tool/test_compareandwrite_dpofua.c | 1 + test-tool/test_get_lba_status_unmap_single.c | 4 ++-- test-tool/test_iscsi_datasn_invalid.c | 2 ++ test-tool/test_nomedia_sbc.c | 1 + test-tool/test_orwrite_beyond_eol.c | 1 + test-tool/test_orwrite_dpofua.c | 1 + test-tool/test_orwrite_simple.c | 2 +- test-tool/test_orwrite_wrprotect.c | 1 + test-tool/test_read10_invalid.c | 1 + test-tool/test_readonly_sbc.c | 1 + test-tool/test_verify10_beyond_eol.c | 1 + test-tool/test_verify12_beyond_eol.c | 1 + test-tool/test_verify16_beyond_eol.c | 1 + test-tool/test_write10_beyond_eol.c | 1 + test-tool/test_write10_dpofua.c | 1 + test-tool/test_write10_flags.c | 1 + test-tool/test_write10_residuals.c | 1 + test-tool/test_write10_simple.c | 2 +- test-tool/test_write10_wrprotect.c | 1 + test-tool/test_write12_beyond_eol.c | 1 + test-tool/test_write12_dpofua.c | 1 + test-tool/test_write12_flags.c | 1 + test-tool/test_write12_residuals.c | 1 + test-tool/test_write12_simple.c | 2 +- test-tool/test_write12_wrprotect.c | 1 + test-tool/test_write16_beyond_eol.c | 1 + test-tool/test_write16_dpofua.c | 1 + test-tool/test_write16_flags.c | 1 + test-tool/test_write16_residuals.c | 1 + test-tool/test_write16_simple.c | 2 +- test-tool/test_write16_wrprotect.c | 1 + test-tool/test_writesame10_unmap.c | 1 + test-tool/test_writesame10_unmap_unaligned.c | 1 + test-tool/test_writesame16_unmap.c | 2 +- test-tool/test_writesame16_unmap_until_end.c | 1 + test-tool/test_writeverify10_beyond_eol.c | 1 + test-tool/test_writeverify10_flags.c | 1 + test-tool/test_writeverify10_residuals.c | 1 + test-tool/test_writeverify10_simple.c | 2 +- test-tool/test_writeverify10_wrprotect.c | 1 + test-tool/test_writeverify12_beyond_eol.c | 1 + test-tool/test_writeverify12_flags.c | 1 + test-tool/test_writeverify12_residuals.c | 1 + test-tool/test_writeverify12_simple.c | 2 +- test-tool/test_writeverify12_wrprotect.c | 1 + test-tool/test_writeverify16_beyond_eol.c | 1 + test-tool/test_writeverify16_dpo.c | 1 + test-tool/test_writeverify16_flags.c | 1 + test-tool/test_writeverify16_residuals.c | 1 + test-tool/test_writeverify16_simple.c | 2 +- test-tool/test_writeverify16_wrprotect.c | 1 + 51 files changed, 53 insertions(+), 10 deletions(-) diff --git a/test-tool/test_compareandwrite_dpofua.c b/test-tool/test_compareandwrite_dpofua.c index 1190b66..4ca79df 100644 --- a/test-tool/test_compareandwrite_dpofua.c +++ b/test-tool/test_compareandwrite_dpofua.c @@ -60,6 +60,7 @@ test_compareandwrite_dpofua(void) } logging(LOG_VERBOSE, "Test COMPAREANDWRITE with DPO==1"); + memset(buf, 0xa6, block_size); if (dpofua) { ret = compareandwrite(sd, 0, buf, block_size, block_size, 0, 1, 0, 0, diff --git a/test-tool/test_get_lba_status_unmap_single.c b/test-tool/test_get_lba_status_unmap_single.c index e174c02..508712a 100644 --- a/test-tool/test_get_lba_status_unmap_single.c +++ b/test-tool/test_get_lba_status_unmap_single.c @@ -30,7 +30,7 @@ test_get_lba_status_unmap_single(void) { int ret; uint64_t i; - unsigned char *buf = alloca(257 * block_size); + unsigned char *buf = alloca((256 + lbppb + 1) * block_size); struct unmap_list list[1]; struct scsi_task *t = NULL; struct scsi_get_lba_status *lbas = NULL; @@ -40,7 +40,7 @@ test_get_lba_status_unmap_single(void) CHECK_FOR_THIN_PROVISIONING; CHECK_FOR_LBPU; - memset(buf, 'A', 257 * block_size); + memset(buf, 'A', (256 + lbppb + 1) * block_size); logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test GET_LBA_STATUS for a single unmapped block " diff --git a/test-tool/test_iscsi_datasn_invalid.c b/test-tool/test_iscsi_datasn_invalid.c index 61cbae7..0b4f652 100644 --- a/test-tool/test_iscsi_datasn_invalid.c +++ b/test-tool/test_iscsi_datasn_invalid.c @@ -82,6 +82,8 @@ void test_iscsi_datasn_invalid(void) iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); iscsi_set_timeout(sd->iscsi_ctx, 3); + memset(buf, 0xa6, 2 * block_size); + ret = write10(sd, 100, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_nomedia_sbc.c b/test-tool/test_nomedia_sbc.c index b9dc0af..eddad9d 100644 --- a/test-tool/test_nomedia_sbc.c +++ b/test-tool/test_nomedia_sbc.c @@ -139,6 +139,7 @@ test_nomedia_sbc(void) } logging(LOG_VERBOSE, "Test VERIFY10 when medium is ejected."); + memset(buf, 0xa6, sizeof(buf)); ret = verify10(sd, 0, block_size, block_size, 0, 0, 1, buf, EXPECT_NO_MEDIUM); diff --git a/test-tool/test_orwrite_beyond_eol.c b/test-tool/test_orwrite_beyond_eol.c index a4745af..8ed4d00 100644 --- a/test-tool/test_orwrite_beyond_eol.c +++ b/test-tool/test_orwrite_beyond_eol.c @@ -36,6 +36,7 @@ test_orwrite_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test ORWRITE 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_orwrite_dpofua.c b/test-tool/test_orwrite_dpofua.c index 6e71f74..f845594 100644 --- a/test-tool/test_orwrite_dpofua.c +++ b/test-tool/test_orwrite_dpofua.c @@ -60,6 +60,7 @@ test_orwrite_dpofua(void) } logging(LOG_VERBOSE, "Test ORWRITE with DPO==1"); + memset(buf, 0xa6, block_size); if (dpofua) { ret = orwrite(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, diff --git a/test-tool/test_orwrite_simple.c b/test-tool/test_orwrite_simple.c index d1fb5c6..f29dfad 100644 --- a/test-tool/test_orwrite_simple.c +++ b/test-tool/test_orwrite_simple.c @@ -37,7 +37,7 @@ test_orwrite_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test ORWRITE of 1-256 blocks at the start of the LUN"); - + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_orwrite_wrprotect.c b/test-tool/test_orwrite_wrprotect.c index fd1e6be..6fa0e05 100644 --- a/test-tool/test_orwrite_wrprotect.c +++ b/test-tool/test_orwrite_wrprotect.c @@ -41,6 +41,7 @@ test_orwrite_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + memset(buf, 0xa6, block_size); if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { diff --git a/test-tool/test_read10_invalid.c b/test-tool/test_read10_invalid.c index 40e55c2..36952f2 100644 --- a/test-tool/test_read10_invalid.c +++ b/test-tool/test_read10_invalid.c @@ -245,6 +245,7 @@ test_read10_invalid(void) task->xfer_dir = SCSI_XFER_WRITE; task->expxferlen = block_size; + memset(buf, 0xa6, block_size); data.size = block_size; data.data = (unsigned char *)buf; diff --git a/test-tool/test_readonly_sbc.c b/test-tool/test_readonly_sbc.c index acfced1..6f1f0d4 100644 --- a/test-tool/test_readonly_sbc.c +++ b/test-tool/test_readonly_sbc.c @@ -41,6 +41,7 @@ test_readonly_sbc(void) logging(LOG_VERBOSE, "Test WRITE10 fails with WRITE_PROTECTED"); + memset(buf, 0xa6, sizeof(buf)); ret = write10(sd, 0, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_WRITE_PROTECTED); diff --git a/test-tool/test_verify10_beyond_eol.c b/test-tool/test_verify10_beyond_eol.c index 9b80296..2089b97 100644 --- a/test-tool/test_verify10_beyond_eol.c +++ b/test-tool/test_verify10_beyond_eol.c @@ -38,6 +38,7 @@ test_verify10_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY10 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_verify12_beyond_eol.c b/test-tool/test_verify12_beyond_eol.c index 4d56cf2..6a3f6a7 100644 --- a/test-tool/test_verify12_beyond_eol.c +++ b/test-tool/test_verify12_beyond_eol.c @@ -38,6 +38,7 @@ test_verify12_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_verify16_beyond_eol.c b/test-tool/test_verify16_beyond_eol.c index e494b97..54843bf 100644 --- a/test-tool/test_verify16_beyond_eol.c +++ b/test-tool/test_verify16_beyond_eol.c @@ -34,6 +34,7 @@ test_verify16_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_write10_beyond_eol.c b/test-tool/test_write10_beyond_eol.c index 1e1ab09..21a5f7b 100644 --- a/test-tool/test_write10_beyond_eol.c +++ b/test-tool/test_write10_beyond_eol.c @@ -40,6 +40,7 @@ test_write10_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE10 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_write10_dpofua.c b/test-tool/test_write10_dpofua.c index 9f5e55c..23ee387 100644 --- a/test-tool/test_write10_dpofua.c +++ b/test-tool/test_write10_dpofua.c @@ -60,6 +60,7 @@ test_write10_dpofua(void) } logging(LOG_VERBOSE, "Test WRITE10 with DPO==1"); + memset(buf, 0xa6, block_size); if (dpofua) { ret = write10(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, diff --git a/test-tool/test_write10_flags.c b/test-tool/test_write10_flags.c index f3305a8..e32c66c 100644 --- a/test-tool/test_write10_flags.c +++ b/test-tool/test_write10_flags.c @@ -38,6 +38,7 @@ test_write10_flags(void) logging(LOG_VERBOSE, "Test WRITE10 flags"); logging(LOG_VERBOSE, "Test WRITE10 with DPO==1"); + memset(buf, 0xa6, block_size); ret = write10(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_write10_residuals.c b/test-tool/test_write10_residuals.c index 7c68d47..d109327 100644 --- a/test-tool/test_write10_residuals.c +++ b/test-tool/test_write10_residuals.c @@ -121,6 +121,7 @@ test_write10_residuals(void) task->xfer_dir = SCSI_XFER_WRITE; task->expxferlen = 10000; + memset(buf, 0xa6, sizeof(buf)); data.size = task->expxferlen; data.data = &buf[0]; task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); diff --git a/test-tool/test_write10_simple.c b/test-tool/test_write10_simple.c index aa50f82..aaef4dd 100644 --- a/test-tool/test_write10_simple.c +++ b/test-tool/test_write10_simple.c @@ -37,7 +37,7 @@ test_write10_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE10 of 1-256 blocks at the start of the LUN"); - + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_write10_wrprotect.c b/test-tool/test_write10_wrprotect.c index 84ae438..e61106e 100644 --- a/test-tool/test_write10_wrprotect.c +++ b/test-tool/test_write10_wrprotect.c @@ -41,6 +41,7 @@ test_write10_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + memset(buf, 0xa6, block_size); if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { diff --git a/test-tool/test_write12_beyond_eol.c b/test-tool/test_write12_beyond_eol.c index a466356..7246670 100644 --- a/test-tool/test_write12_beyond_eol.c +++ b/test-tool/test_write12_beyond_eol.c @@ -40,6 +40,7 @@ test_write12_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE12 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_write12_dpofua.c b/test-tool/test_write12_dpofua.c index dd20a4d..91e3585 100644 --- a/test-tool/test_write12_dpofua.c +++ b/test-tool/test_write12_dpofua.c @@ -60,6 +60,7 @@ test_write12_dpofua(void) } logging(LOG_VERBOSE, "Test WRITE12 with DPO==1"); + memset(buf, 0xa6, block_size); if (dpofua) { ret = write12(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, diff --git a/test-tool/test_write12_flags.c b/test-tool/test_write12_flags.c index f2f68d4..54843d8 100644 --- a/test-tool/test_write12_flags.c +++ b/test-tool/test_write12_flags.c @@ -38,6 +38,7 @@ test_write12_flags(void) logging(LOG_VERBOSE, "Test WRITE12 flags"); logging(LOG_VERBOSE, "Test WRITE12 with DPO==1"); + memset(buf, 0xa6, block_size); ret = write12(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_write12_residuals.c b/test-tool/test_write12_residuals.c index 854b840..a4c6831 100644 --- a/test-tool/test_write12_residuals.c +++ b/test-tool/test_write12_residuals.c @@ -121,6 +121,7 @@ test_write12_residuals(void) task->xfer_dir = SCSI_XFER_WRITE; task->expxferlen = 10000; + memset(buf, 0xa6, sizeof(buf)); data.size = task->expxferlen; data.data = &buf[0]; task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); diff --git a/test-tool/test_write12_simple.c b/test-tool/test_write12_simple.c index 1d9860b..ef0a004 100644 --- a/test-tool/test_write12_simple.c +++ b/test-tool/test_write12_simple.c @@ -36,7 +36,7 @@ test_write12_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE12 of 1-256 blocks at the start of the LUN"); - + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_write12_wrprotect.c b/test-tool/test_write12_wrprotect.c index b48ea12..6864b15 100644 --- a/test-tool/test_write12_wrprotect.c +++ b/test-tool/test_write12_wrprotect.c @@ -42,6 +42,7 @@ test_write12_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + memset(buf, 0xa6, block_size); if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { diff --git a/test-tool/test_write16_beyond_eol.c b/test-tool/test_write16_beyond_eol.c index 6da51d6..bff71fd 100644 --- a/test-tool/test_write16_beyond_eol.c +++ b/test-tool/test_write16_beyond_eol.c @@ -37,6 +37,7 @@ test_write16_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE16 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_write16_dpofua.c b/test-tool/test_write16_dpofua.c index c3f0e85..e0e93f2 100644 --- a/test-tool/test_write16_dpofua.c +++ b/test-tool/test_write16_dpofua.c @@ -60,6 +60,7 @@ test_write16_dpofua(void) } logging(LOG_VERBOSE, "Test WRITE16 with DPO==1"); + memset(buf, 0xa6, block_size); if (dpofua) { ret = write16(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, diff --git a/test-tool/test_write16_flags.c b/test-tool/test_write16_flags.c index 3750c8a..c7d15be 100644 --- a/test-tool/test_write16_flags.c +++ b/test-tool/test_write16_flags.c @@ -39,6 +39,7 @@ test_write16_flags(void) logging(LOG_VERBOSE, "Test WRITE16 flags"); logging(LOG_VERBOSE, "Test WRITE16 with DPO==1"); + memset(buf, 0xa6, block_size); ret = write16(sd, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_write16_residuals.c b/test-tool/test_write16_residuals.c index 6860994..6f13ac9 100644 --- a/test-tool/test_write16_residuals.c +++ b/test-tool/test_write16_residuals.c @@ -121,6 +121,7 @@ test_write16_residuals(void) task->xfer_dir = SCSI_XFER_WRITE; task->expxferlen = 10000; + memset(buf, 0xa6, sizeof(buf)); data.size = task->expxferlen; data.data = &buf[0]; task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); diff --git a/test-tool/test_write16_simple.c b/test-tool/test_write16_simple.c index 10f54ea..3989b72 100644 --- a/test-tool/test_write16_simple.c +++ b/test-tool/test_write16_simple.c @@ -38,7 +38,7 @@ test_write16_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE16 of 1-256 blocks at the start of the LUN"); - + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_write16_wrprotect.c b/test-tool/test_write16_wrprotect.c index 242dc2a..d38d6df 100644 --- a/test-tool/test_write16_wrprotect.c +++ b/test-tool/test_write16_wrprotect.c @@ -41,6 +41,7 @@ test_write16_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + memset(buf, 0xa6, block_size); if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { diff --git a/test-tool/test_writesame10_unmap.c b/test-tool/test_writesame10_unmap.c index 065efff..f191e9a 100644 --- a/test-tool/test_writesame10_unmap.c +++ b/test-tool/test_writesame10_unmap.c @@ -58,6 +58,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITESAME10 of 1-256 blocks at the start of " "the LUN"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); diff --git a/test-tool/test_writesame10_unmap_unaligned.c b/test-tool/test_writesame10_unmap_unaligned.c index 3a121eb..2b6ec31 100644 --- a/test-tool/test_writesame10_unmap_unaligned.c +++ b/test-tool/test_writesame10_unmap_unaligned.c @@ -39,6 +39,7 @@ test_writesame10_unmap_unaligned(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test that unaligned WRITESAME10 Unmap succeeds. LBPPB==%d", lbppb); + memset(buf, 0xa6, block_size); for (i = 1; i < lbppb; i++) { logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10 at LBA:%d", lbppb - i, i); ret = writesame10(sd, i, diff --git a/test-tool/test_writesame16_unmap.c b/test-tool/test_writesame16_unmap.c index 0a019f4..638b015 100644 --- a/test-tool/test_writesame16_unmap.c +++ b/test-tool/test_writesame16_unmap.c @@ -56,7 +56,7 @@ test_writesame16_unmap(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITESAME16 of 1-256 blocks at the start of the LUN"); - buf = malloc(65536 * block_size); + buf = calloc(65536, block_size); for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); diff --git a/test-tool/test_writesame16_unmap_until_end.c b/test-tool/test_writesame16_unmap_until_end.c index 76e0d58..a24b59f 100644 --- a/test-tool/test_writesame16_unmap_until_end.c +++ b/test-tool/test_writesame16_unmap_until_end.c @@ -44,6 +44,7 @@ test_writesame16_unmap_until_end(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITESAME16 of 1-256 blocks at the end of the LUN by setting number-of-blocks==0"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, block_size * i); diff --git a/test-tool/test_writeverify10_beyond_eol.c b/test-tool/test_writeverify10_beyond_eol.c index 6dad866..e2bb2be 100644 --- a/test-tool/test_writeverify10_beyond_eol.c +++ b/test-tool/test_writeverify10_beyond_eol.c @@ -40,6 +40,7 @@ test_writeverify10_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY10 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_writeverify10_flags.c b/test-tool/test_writeverify10_flags.c index 6af3919..16823e3 100644 --- a/test-tool/test_writeverify10_flags.c +++ b/test-tool/test_writeverify10_flags.c @@ -39,6 +39,7 @@ test_writeverify10_flags(void) logging(LOG_VERBOSE, "Test WRITEVERIFY10 with BYTCHK==1"); + memset(buf, 0xa6, block_size); ret = writeverify10(sd, 0, block_size, block_size, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_writeverify10_residuals.c b/test-tool/test_writeverify10_residuals.c index 287ec85..ee9bd0d 100644 --- a/test-tool/test_writeverify10_residuals.c +++ b/test-tool/test_writeverify10_residuals.c @@ -130,6 +130,7 @@ test_writeverify10_residuals(void) task->xfer_dir = SCSI_XFER_WRITE; task->expxferlen = 10000; + memset(buf, 0xa6, sizeof(buf)); data.size = task->expxferlen; data.data = &buf[0]; task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); diff --git a/test-tool/test_writeverify10_simple.c b/test-tool/test_writeverify10_simple.c index 4e64767..d3ce931 100644 --- a/test-tool/test_writeverify10_simple.c +++ b/test-tool/test_writeverify10_simple.c @@ -36,7 +36,7 @@ test_writeverify10_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY10 of 1-256 blocks at the start of the LUN"); - + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_writeverify10_wrprotect.c b/test-tool/test_writeverify10_wrprotect.c index 7364ddb..5d205c9 100644 --- a/test-tool/test_writeverify10_wrprotect.c +++ b/test-tool/test_writeverify10_wrprotect.c @@ -41,6 +41,7 @@ test_writeverify10_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + memset(buf, 0xa6, block_size); if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { diff --git a/test-tool/test_writeverify12_beyond_eol.c b/test-tool/test_writeverify12_beyond_eol.c index 0a158c4..70c5d68 100644 --- a/test-tool/test_writeverify12_beyond_eol.c +++ b/test-tool/test_writeverify12_beyond_eol.c @@ -40,6 +40,7 @@ test_writeverify12_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY12 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_writeverify12_flags.c b/test-tool/test_writeverify12_flags.c index a47e7c9..bcc2c8b 100644 --- a/test-tool/test_writeverify12_flags.c +++ b/test-tool/test_writeverify12_flags.c @@ -39,6 +39,7 @@ test_writeverify12_flags(void) logging(LOG_VERBOSE, "Test WRITEVERIFY12 with BYTCHK==1"); + memset(buf, 0xa6, block_size); ret = writeverify12(sd, 0, block_size, block_size, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_writeverify12_residuals.c b/test-tool/test_writeverify12_residuals.c index 879bbf8..a0efdf7 100644 --- a/test-tool/test_writeverify12_residuals.c +++ b/test-tool/test_writeverify12_residuals.c @@ -130,6 +130,7 @@ test_writeverify12_residuals(void) task->xfer_dir = SCSI_XFER_WRITE; task->expxferlen = 10000; + memset(buf, 0xa6, sizeof(buf)); data.size = task->expxferlen; data.data = &buf[0]; task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); diff --git a/test-tool/test_writeverify12_simple.c b/test-tool/test_writeverify12_simple.c index 1fc0054..6649084 100644 --- a/test-tool/test_writeverify12_simple.c +++ b/test-tool/test_writeverify12_simple.c @@ -36,7 +36,7 @@ test_writeverify12_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY12 of 1-256 blocks at the start of the LUN"); - + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_writeverify12_wrprotect.c b/test-tool/test_writeverify12_wrprotect.c index fac88d4..6d4aadc 100644 --- a/test-tool/test_writeverify12_wrprotect.c +++ b/test-tool/test_writeverify12_wrprotect.c @@ -41,6 +41,7 @@ test_writeverify12_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + memset(buf, 0xa6, block_size); if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { diff --git a/test-tool/test_writeverify16_beyond_eol.c b/test-tool/test_writeverify16_beyond_eol.c index 7af0a7f..91de3cf 100644 --- a/test-tool/test_writeverify16_beyond_eol.c +++ b/test-tool/test_writeverify16_beyond_eol.c @@ -36,6 +36,7 @@ test_writeverify16_beyond_eol(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY16 1-256 blocks one block beyond the end"); + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_writeverify16_dpo.c b/test-tool/test_writeverify16_dpo.c index 14c43ba..3ce4c7b 100644 --- a/test-tool/test_writeverify16_dpo.c +++ b/test-tool/test_writeverify16_dpo.c @@ -64,6 +64,7 @@ test_writeverify16_dpo(void) } logging(LOG_VERBOSE, "Test WRITEVERIFY16 with DPO==1"); + memset(buf, 0xa6, block_size); if (dpofua) { ret = writeverify16(sd, 0, block_size, block_size, 0, 1, 0, 0, buf, diff --git a/test-tool/test_writeverify16_flags.c b/test-tool/test_writeverify16_flags.c index 722252a..59febca 100644 --- a/test-tool/test_writeverify16_flags.c +++ b/test-tool/test_writeverify16_flags.c @@ -39,6 +39,7 @@ test_writeverify16_flags(void) logging(LOG_VERBOSE, "Test WRITEVERIFY16 with BYTCHK==1"); + memset(buf, 0xa6, block_size); ret = writeverify16(sd, 0, block_size, block_size, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_writeverify16_residuals.c b/test-tool/test_writeverify16_residuals.c index 72f84a8..af98722 100644 --- a/test-tool/test_writeverify16_residuals.c +++ b/test-tool/test_writeverify16_residuals.c @@ -139,6 +139,7 @@ test_writeverify16_residuals(void) task->xfer_dir = SCSI_XFER_WRITE; task->expxferlen = 10000; + memset(buf, 0xa6, sizeof(buf)); data.size = task->expxferlen; data.data = &buf[0]; task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); diff --git a/test-tool/test_writeverify16_simple.c b/test-tool/test_writeverify16_simple.c index d36558a..135d085 100644 --- a/test-tool/test_writeverify16_simple.c +++ b/test-tool/test_writeverify16_simple.c @@ -37,7 +37,7 @@ test_writeverify16_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY16 of 1-256 blocks at the start of the LUN"); - + memset(buf, 0xa6, 256 * block_size); for (i = 1; i <= 256; i++) { if (maximum_transfer_length && maximum_transfer_length < i) { break; diff --git a/test-tool/test_writeverify16_wrprotect.c b/test-tool/test_writeverify16_wrprotect.c index 48ef14a..3a0bd7a 100644 --- a/test-tool/test_writeverify16_wrprotect.c +++ b/test-tool/test_writeverify16_wrprotect.c @@ -43,6 +43,7 @@ test_writeverify16_wrprotect(void) CHECK_FOR_DATALOSS; CHECK_FOR_SBC; + memset(buf, 0xa6, block_size); if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) { logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) {