* [PATCH] x86/sev: Replace memset(0) and kfree() with kfree_sensitive()
@ 2025-07-06 9:28 Thorsten Blum
2025-07-06 21:18 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-07-06 9:28 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Tom Lendacky, Nikunj A Dadhania, Ard Biesheuvel,
Alexey Kardashevskiy, Ashish Kalra
Cc: Thorsten Blum, kernel test robot, Ingo Molnar, linux-kernel
Replace memset(0) followed by kfree() with kfree_sensitive() to improve
snp_msg_free() and silence the following Coccinelle/coccicheck warning
reported by kfree_sensitive.cocci:
WARNING opportunity for kfree_sensitive/kvfree_sensitive
No functional changes intended.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202501141317.IrSGK4Et-lkp@intel.com/
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/x86/coco/sev/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index b6db4e0b936b..4bc8423cfd79 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -1768,8 +1768,7 @@ void snp_msg_free(struct snp_msg_desc *mdesc)
free_shared_pages(mdesc->request, sizeof(struct snp_guest_msg));
iounmap((__force void __iomem *)mdesc->secrets);
- memset(mdesc, 0, sizeof(*mdesc));
- kfree(mdesc);
+ kfree_sensitive(mdesc);
}
EXPORT_SYMBOL_GPL(snp_msg_free);
--
2.50.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/sev: Replace memset(0) and kfree() with kfree_sensitive()
2025-07-06 9:28 [PATCH] x86/sev: Replace memset(0) and kfree() with kfree_sensitive() Thorsten Blum
@ 2025-07-06 21:18 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2025-07-06 21:18 UTC (permalink / raw)
To: Thorsten Blum
Cc: Thomas Gleixner, Ingo Molnar, Dave Hansen, x86, H. Peter Anvin,
Tom Lendacky, Nikunj A Dadhania, Ard Biesheuvel,
Alexey Kardashevskiy, Ashish Kalra, kernel test robot,
Ingo Molnar, linux-kernel
On Sun, Jul 06, 2025 at 11:28:44AM +0200, Thorsten Blum wrote:
> Replace memset(0) followed by kfree() with kfree_sensitive() to improve
> snp_msg_free()
Improve how?
> and silence the following Coccinelle/coccicheck warning
> reported by kfree_sensitive.cocci:
We don't do patches just to silence tools.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-06 21:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-06 9:28 [PATCH] x86/sev: Replace memset(0) and kfree() with kfree_sensitive() Thorsten Blum
2025-07-06 21:18 ` Borislav Petkov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.