Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1584086 > unrolled thread
| Started by | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| First post | 2017-02-19 10:40 +0100 |
| Last post | 2017-02-20 16:40 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] qlcnic: Fix a memory leak in error handling path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-02-19 10:40 +0100
Re: [PATCH] qlcnic: Fix a memory leak in error handling path David Miller <davem@davemloft.net> - 2017-02-20 16:40 +0100
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Date | 2017-02-19 10:40 +0100 |
| Subject | [PATCH] qlcnic: Fix a memory leak in error handling path |
| Message-ID | <tcw8i-5G5-13@gated-at.bofh.it> |
If 'dma_alloc_coherent()' fails, we should release resources allocated so
far, just as done in all other cases in this function.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
checkpatch.pl complains about '== NULL'. I have left it as-is because both
'== NULL' and '!' are already used in the file.
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
index daf05155b732..d344e9d43832 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
@@ -573,8 +573,10 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
ptr = (__le32 *)dma_alloc_coherent(&pdev->dev, sizeof(u32),
&tx_ring->hw_cons_phys_addr,
GFP_KERNEL);
- if (ptr == NULL)
- return -ENOMEM;
+ if (ptr == NULL) {
+ err = -ENOMEM;
+ goto err_out_free;
+ }
tx_ring->hw_consumer = ptr;
/* cmd desc ring */
--
2.9.3
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-02-20 16:40 +0100 |
| Message-ID | <tcYee-6r1-23@gated-at.bofh.it> |
| In reply to | #1584086 |
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Date: Sun, 19 Feb 2017 10:35:05 +0100 > If 'dma_alloc_coherent()' fails, we should release resources allocated so > far, just as done in all other cases in this function. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web