netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: netdev@vger.kernel.org, bugme-daemon@bugzilla.kernel.org,
	danielm77@spray.se, Jay Cliburn <jacliburn@bellsouth.net>
Subject: Re: [Bugme-new] [Bug 12087] New: [drivers/net/cxgb3/sge.c:563]: Possible memory leak: s
Date: Sat, 22 Nov 2008 22:03:05 -0800	[thread overview]
Message-ID: <adaiqqff086.fsf@cisco.com> (raw)
In-Reply-To: <20081122213532.fe01a22c.akpm@linux-foundation.org> (Andrew Morton's message of "Sat, 22 Nov 2008 21:35:32 -0800")

> 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.

  reply	other threads:[~2008-11-23  6:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-12087-10286@http.bugzilla.kernel.org/>
2008-11-23  5:35 ` [Bugme-new] [Bug 12087] New: [drivers/net/cxgb3/sge.c:563]: Possible memory leak: s Andrew Morton
2008-11-23  6:03   ` Roland Dreier [this message]
2008-11-23 11:40   ` Jay Cliburn
2008-11-24 17:04     ` Divy Le Ray
2008-11-27  8:26   ` Divy Le Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adaiqqff086.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=akpm@linux-foundation.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=danielm77@spray.se \
    --cc=jacliburn@bellsouth.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).