dm crypt: use memzero_explicit for on-stack buffer

commit 1a71d6ffe1 upstream.

Use memzero_explicit to cleanup sensitive data allocated on stack
to prevent the compiler from optimizing and removing memset() calls.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Milan Broz 2014-11-22 09:36:04 +01:00 committed by Greg Kroah-Hartman
parent baf2341be0
commit a6e37a9dcf
1 changed files with 1 additions and 1 deletions

View File

@ -709,7 +709,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc,
for (i = 0; i < ((1 << SECTOR_SHIFT) / 8); i++)
crypto_xor(data + i * 8, buf, 8);
out:
memset(buf, 0, sizeof(buf));
memzero_explicit(buf, sizeof(buf));
return r;
}