The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Antoine Tenart <atenart@kernel.org>
To: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Cc: atenart@kernel.org, herbert@gondor.apana.org.au,
	davem@davemloft.net,  linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, pvanleeuwen@insidesecure.com
Subject: Re: [PATCH] crypto: safexcel - Fix potential memory leak in safexcel_pci_probe()
Date: Mon, 11 May 2026 09:46:33 +0200	[thread overview]
Message-ID: <agGJOTq35e4C9XCg@kwain> (raw)
In-Reply-To: <20260508090347.74176-1-nihaal@cse.iitm.ac.in>

On Fri, May 08, 2026 at 02:33:45PM +0530, Abdun Nihaal wrote:
> The memory allocated for priv in safexcel_pci_probe() is not freed in the
> error paths, as well as in the PCI remove function. Fix this by using
> device managed allocation.
> 
> Fixes: 625f269a5a7a ("crypto: inside-secure - add support for PCI based FPGA development board")
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>

Reviewed-by: Antoine Tenart <atenart@kernel.org>

Thanks!

> ---
> Compile tested only. Issue found using static analysis.
> 
>  drivers/crypto/inside-secure/safexcel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
> index fb4936e7afa2..2bd8641a07b3 100644
> --- a/drivers/crypto/inside-secure/safexcel.c
> +++ b/drivers/crypto/inside-secure/safexcel.c
> @@ -1893,7 +1893,7 @@ static int safexcel_pci_probe(struct pci_dev *pdev,
>  		ent->vendor, ent->device, ent->subvendor,
>  		ent->subdevice, ent->driver_data);
>  
> -	priv = kzalloc_obj(*priv);
> +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
>  
> -- 
> 2.43.0
> 

      reply	other threads:[~2026-05-11  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  9:03 [PATCH] crypto: safexcel - Fix potential memory leak in safexcel_pci_probe() Abdun Nihaal
2026-05-11  7:46 ` Antoine Tenart [this message]

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=agGJOTq35e4C9XCg@kwain \
    --to=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nihaal@cse.iitm.ac.in \
    --cc=pvanleeuwen@insidesecure.com \
    /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