The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] crypto: safexcel - Fix potential memory leak in safexcel_pci_probe()
@ 2026-05-08  9:03 Abdun Nihaal
  2026-05-11  7:46 ` Antoine Tenart
  0 siblings, 1 reply; 2+ messages in thread
From: Abdun Nihaal @ 2026-05-08  9:03 UTC (permalink / raw)
  To: atenart
  Cc: Abdun Nihaal, herbert, davem, linux-crypto, linux-kernel,
	pvanleeuwen

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>
---
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: safexcel - Fix potential memory leak in safexcel_pci_probe()
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Antoine Tenart @ 2026-05-11  7:46 UTC (permalink / raw)
  To: Abdun Nihaal
  Cc: atenart, herbert, davem, linux-crypto, linux-kernel, pvanleeuwen

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-11  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox