From: Abdun Nihaal Date: Fri, 8 May 2026 09:03:45 +0000 (+0530) Subject: crypto: safexcel - Fix potential memory leak in safexcel_pci_probe() X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=c36faca103a685590281412e47df74b550f71886;p=thirdparty%2Flinux.git crypto: safexcel - Fix potential memory leak in safexcel_pci_probe() 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 Reviewed-by: Antoine Tenart Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c index 812ebabd13096..52809e57361aa 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;