ut/blob: fully initialize payload_pattern in split_iov test

Valgrind found this on my system.  The unit test itself
was passing correctly (we wrote uninitialized data and then
successfully read back the same uninitialized data) - but
Valgrind doesn't like code that makes any decisions based
on reading uninitialized memory.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I762f5dd0cb368328bd5eba9cecf7db404b457fad

Reviewed-on: https://review.gerrithub.io/424109
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Jim Harris 2018-08-30 09:06:31 -07:00 committed by Changpeng Liu
parent 93edd7b023
commit 051fd012fc

View File

@ -1832,7 +1832,7 @@ blob_operation_split_rw_iov(void)
struct iovec iov_read[2]; struct iovec iov_read[2];
struct iovec iov_write[2]; struct iovec iov_write[2];
uint64_t i; uint64_t i, j;
dev = init_dev(); dev = init_dev();
@ -1858,7 +1858,13 @@ blob_operation_split_rw_iov(void)
/* Prepare random pattern to write */ /* Prepare random pattern to write */
for (i = 0; i < pages_per_payload; i++) { for (i = 0; i < pages_per_payload; i++) {
*((uint64_t *)(payload_pattern + page_size * i)) = (i + 1); for (j = 0; j < page_size / sizeof(uint64_t); j++) {
uint64_t *tmp;
tmp = (uint64_t *)payload_pattern;
tmp += ((page_size * i) / sizeof(uint64_t)) + j;
*tmp = i + 1;
}
} }
channel = spdk_bs_alloc_io_channel(bs); channel = spdk_bs_alloc_io_channel(bs);