Thread (15 messages) 15 messages, 6 authors, 2025-08-30

Re: [PATCH V2] crypto: Mark intermediary memory as clean

From: Edward Adam Davis <hidden>
Date: 2025-08-18 12:22:28
Also in: lkml

On Sun, 17 Aug 2025 19:40:56 +0800, Herbert Xu wrote:
quoted
diff --git a/crypto/jitterentropy-kcapi.c b/crypto/jitterentropy-kcapi.c
index 1266eb790708..4020a6e41b0e 100644
--- a/crypto/jitterentropy-kcapi.c
+++ b/crypto/jitterentropy-kcapi.c
@@ -117,6 +117,7 @@ int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,
 		pr_warn_ratelimited("Unexpected digest size\n");
 		return -EINVAL;
 	}
+	kmsan_unpoison_memory(intermediary, SHA3_256_DIGEST_SIZE);
Please change SHA3_256_DIGEST_SIZE to sizeof(intermediary).
Why?
Their values are equal, so why use sizeof to calculate?
Similarly, "if (sizeof(intermediary) != crypto_shash_digestsize(desc->tfm)) {",
why not just use SHA3_256_DIGEST_SIZE?

BR,
Edward
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help