* [PATCH 2/4 2.6.29] cxgb3 - avoid potential memory leak.
@ 2008-11-26 20:38 Divy Le Ray
2008-11-26 23:36 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Divy Le Ray @ 2008-11-26 20:38 UTC (permalink / raw)
To: jeff; +Cc: davem, netdev, linux-kernel, swise
From: Divy Le Ray <divy@chelsio.com>
Add consistency in alloc_ring() parameter checking
to avoid potential memory leaks.
alloc_ring() callers are correct fo far.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
---
drivers/net/cxgb3/sge.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 268f158..bc6a8dc 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -549,16 +549,15 @@ static void *alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size,
if (!p)
return NULL;
- if (sw_size) {
+ if (sw_size && metadata) {
s = kcalloc(nelem, sw_size, GFP_KERNEL);
if (!s) {
dma_free_coherent(&pdev->dev, len, p, *phys);
return NULL;
}
- }
- if (metadata)
*(void **)metadata = s;
+ }
memset(p, 0, len);
return p;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/4 2.6.29] cxgb3 - avoid potential memory leak.
2008-11-26 20:38 [PATCH 2/4 2.6.29] cxgb3 - avoid potential memory leak Divy Le Ray
@ 2008-11-26 23:36 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-11-26 23:36 UTC (permalink / raw)
To: divy; +Cc: jeff, netdev, linux-kernel, swise
From: Divy Le Ray <divy@chelsio.com>
Date: Wed, 26 Nov 2008 12:38:20 -0800
> From: Divy Le Ray <divy@chelsio.com>
>
> Add consistency in alloc_ring() parameter checking
> to avoid potential memory leaks.
> alloc_ring() callers are correct fo far.
>
> Signed-off-by: Divy Le Ray <divy@chelsio.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-26 23:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-26 20:38 [PATCH 2/4 2.6.29] cxgb3 - avoid potential memory leak Divy Le Ray
2008-11-26 23:36 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox