Merge pull request #39731 from mychoxin/use_unified_zero_func

rbd: use portable zero-ing memory function

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2021-03-01 13:24:46 -05:00 committed by GitHub
commit 2bda8970e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -212,7 +212,7 @@ void LoadRequest<I>::read_volume_key() {
template <typename I>
void LoadRequest<I>::finish(int r) {
explicit_bzero(&m_passphrase[0], m_passphrase.size());
ceph_memzero_s(&m_passphrase[0], m_passphrase.size(), m_passphrase.size());
m_on_finish->complete(r);
delete this;
}

View File

@ -1660,7 +1660,7 @@ static int do_map(int argc, const char *argv[], Config *cfg, bool reconnect)
std::string passphrase((std::istreambuf_iterator<char>(file)),
(std::istreambuf_iterator<char>()));
auto sg = make_scope_guard([&] {
explicit_bzero(&passphrase[0], passphrase.size()); });
ceph_memzero_s(&passphrase[0], passphrase.size(), passphrase.size()); });
file.close();
if (!passphrase.empty() && passphrase[passphrase.length() - 1] == '\n') {
passphrase.erase(passphrase.length() - 1);