[PATCH -next] NTB: Drop kfree for memory allocated with devm_kzalloc

23 views
Skip to first unread message

Wei Yongjun

unread,
Feb 10, 2021, 2:45:54 AM2/10/21
to Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe, Lorenzo Pieralisi, Kishon Vijay Abraham I, Wei Yongjun, linu...@googlegroups.com, linux-...@vger.kernel.org
It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent Bridge")
Reported-by: Hulk Robot <hul...@huawei.com>
Signed-off-by: Wei Yongjun <weiyo...@huawei.com>
---
drivers/ntb/hw/epf/ntb_hw_epf.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c
index 2cccb7dff5dd..b019755e4e21 100644
--- a/drivers/ntb/hw/epf/ntb_hw_epf.c
+++ b/drivers/ntb/hw/epf/ntb_hw_epf.c
@@ -723,7 +723,6 @@ static void ntb_epf_pci_remove(struct pci_dev *pdev)
ntb_unregister_device(&ndev->ntb);
ntb_epf_cleanup_isr(ndev);
ntb_epf_deinit_pci(ndev);
- kfree(ndev);
}

static const struct ntb_epf_data j721e_data = {

Kishon Vijay Abraham I

unread,
Feb 12, 2021, 7:48:40 AM2/12/21
to Wei Yongjun, Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe, Lorenzo Pieralisi, linu...@googlegroups.com, linux-...@vger.kernel.org, Kishon Vijay Abraham I
Reviewed-by: Kishon Vijay Abraham I <kis...@ti.com>

Lorenzo Pieralisi

unread,
Feb 12, 2021, 12:45:27 PM2/12/21
to Wei Yongjun, Hulk Robot, Jon Mason, Dave Jiang, Allen Hubbe, Kishon Vijay Abraham I, linu...@googlegroups.com, linux-...@vger.kernel.org
On Wed, Feb 10, 2021 at 07:53:45AM +0000, Wei Yongjun wrote:
> It's not necessary to free memory allocated with devm_kzalloc
> and using kfree leads to a double free.
>
> Fixes: 363baf7d6051 ("NTB: Add support for EPF PCI-Express Non-Transparent Bridge")

Squashed it in the commit it is fixing and repushed pci/ntb out.

Thanks,
Lorenzo
Reply all
Reply to author
Forward
0 new messages