1 From 1a71d6ffe18c0d0f03fc8531949cc8ed41d702ee Mon Sep 17 00:00:00 2001
2 From: Milan Broz <gmazyland@gmail.com>
3 Date: Sat, 22 Nov 2014 09:36:04 +0100
4 Subject: dm crypt: use memzero_explicit for on-stack buffer
6 From: Milan Broz <gmazyland@gmail.com>
8 commit 1a71d6ffe18c0d0f03fc8531949cc8ed41d702ee upstream.
10 Use memzero_explicit to cleanup sensitive data allocated on stack
11 to prevent the compiler from optimizing and removing memset() calls.
13 Signed-off-by: Milan Broz <gmazyland@gmail.com>
14 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 drivers/md/dm-crypt.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
21 --- a/drivers/md/dm-crypt.c
22 +++ b/drivers/md/dm-crypt.c
23 @@ -709,7 +709,7 @@ static int crypt_iv_tcw_whitening(struct
24 for (i = 0; i < ((1 << SECTOR_SHIFT) / 8); i++)
25 crypto_xor(data + i * 8, buf, 8);
27 - memset(buf, 0, sizeof(buf));
28 + memzero_explicit(buf, sizeof(buf));