The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Borislav Petkov <bp@alien8.de>, Julia Lawall <julia.lawall@inria.fr>
Cc: Nikunj A Dadhania <nikunj@amd.com>,
	linux-kernel@vger.kernel.org, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH] x86/sev: Use kfree_sensitive() when freeing a SNP message descriptor
Date: Mon, 12 Jan 2026 10:38:51 -0600	[thread overview]
Message-ID: <19d54b7b-df81-451d-b22e-a7fb2e90ba73@amd.com> (raw)
In-Reply-To: <20260112114147.GBaWTd-8HSy_Xp4S3X@fat_crate.local>

On 1/12/26 05:41, Borislav Petkov wrote:
> On Sat, Dec 20, 2025 at 03:25:46PM +0100, Julia Lawall wrote:
>> cocci warnings: (new ones prefixed by >>)
>>>> arch/x86/coco/sev/core.c:2838:12-13: WARNING opportunity for kfree_sensitive/kvfree_sensitive (memset at line 2837)
> 
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
> Date: Mon, 12 Jan 2026 12:37:49 +0100
> 
> Use the proper helper instead of an open-coded variant.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@inria.fr>
> Closes: https://lore.kernel.org/r/202512202235.WHPQkLZu-lkp@intel.com
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
>  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 379e0c09c7f3..38dad3f5f491 100644
> --- a/arch/x86/coco/sev/core.c
> +++ b/arch/x86/coco/sev/core.c
> @@ -1632,8 +1632,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);
>  


  reply	other threads:[~2026-01-12 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-20 14:25 arch/x86/coco/sev/core.c:2838:12-13: WARNING opportunity for kfree_sensitive/kvfree_sensitive (memset at line 2837) (fwd) Julia Lawall
2026-01-12 11:41 ` [PATCH] x86/sev: Use kfree_sensitive() when freeing a SNP message descriptor Borislav Petkov
2026-01-12 16:38   ` Tom Lendacky [this message]
2026-01-20 10:30   ` [tip: x86/sev] " tip-bot2 for Borislav Petkov (AMD)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19d54b7b-df81-451d-b22e-a7fb2e90ba73@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikunj@amd.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox