Re: [Bugme-new] [Bug 12087] New: [drivers/net/cxgb3/sge.c:563]: Possible memory leak: s
From: Roland Dreier <hidden>
Date: 2008-11-23 06:03:09
From: Roland Dreier <hidden>
Date: 2008-11-23 06:03:09
There will be a memory leak in the function alloc_ring when the parameter
sw_size is nonzero and metadata is NULL. I don't know if that can happen.
Here is the code, taken from the latest git tree.
static void *alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size,
size_t sw_size, dma_addr_t * phys, void *metadata)It might make sense to stick a WARN_ON(sw_size && !metadata) in that function or something like that, but a quick audit of the current code (there are only 4 callers of alloc_ring() in that file -- and it's static so we know those are all of them -- all in t3_sge_alloc_qset()) shows that all callers pass non-NULL metadata if sw_size != 0. - R.