From d73a19fea4cf5bd3ceec8710aa0ecc1e77cdc3f6 Mon Sep 17 00:00:00 2001 From: Jingyu Zhou Date: Sun, 2 Feb 2020 13:15:23 -0800 Subject: [PATCH] Fix valgrind found error of reading uninitialized data --- fdbrpc/AsyncFileWriteChecker.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fdbrpc/AsyncFileWriteChecker.h b/fdbrpc/AsyncFileWriteChecker.h index a6e1409487..64a74d24b2 100644 --- a/fdbrpc/AsyncFileWriteChecker.h +++ b/fdbrpc/AsyncFileWriteChecker.h @@ -32,7 +32,10 @@ public: // For read() and write(), the data buffer must remain valid until the future is ready Future read( void* data, int length, int64_t offset ) { - return map(m_f->read(data, length, offset), [=](int r) { updateChecksumHistory(false, offset, length, (uint8_t *)data); return r; }); + return map(m_f->read(data, length, offset), [=](int r) { + updateChecksumHistory(false, offset, r, (uint8_t*)data); + return r; + }); } Future readZeroCopy( void** data, int* length, int64_t offset ) { return map(m_f->readZeroCopy(data, length, offset), [=](Void r) { updateChecksumHistory(false, offset, *length, (uint8_t *)data); return r; });