Skip to content

Commit 141fbbe

Browse files
author
Eric Biggers
committed
lib/crypto: tests: Fix KMSAN warning in test_sha256_finup_2x()
Fully initialize *ctx, including the buf field which sha256_init() doesn't initialize, to avoid a KMSAN warning when comparing *ctx to orig_ctx. This KMSAN warning slipped in while KMSAN was not working reliably due to a stackdepot bug, which has now been fixed. Fixes: 6733968 ("lib/crypto: tests: Add tests and benchmark for sha256_finup_2x()") Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20251121033431.34406-1-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
1 parent 44e8241 commit 141fbbe

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/crypto/tests/sha256_kunit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static void test_sha256_finup_2x(struct kunit *test)
6868
rand_bytes(data1_buf, max_data_len);
6969
rand_bytes(data2_buf, max_data_len);
7070
rand_bytes(salt, sizeof(salt));
71+
memset(ctx, 0, sizeof(*ctx));
7172

7273
for (size_t i = 0; i < 500; i++) {
7374
size_t salt_len = rand_length(sizeof(salt));

0 commit comments

Comments
 (0)