From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: net: add a hardware buffer management helper API
Date: Wed, 16 Mar 2016 19:50:12 +0000 [thread overview]
Message-ID: <20160316195012.GB20386@mwanda> (raw)
Hello Gregory CLEMENT,
The patch 8cb2d8bf57e6: "net: add a hardware buffer management helper
API" from Mar 14, 2016, leads to the following static checker warning:
net/core/hwbm.c:46 hwbm_pool_refill()
warn: possible memory leak of 'buf'
net/core/hwbm.c
26 /* Refill processing for HW buffer management */
27 int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp)
28 {
29 int frag_size = bm_pool->frag_size;
30 void *buf;
31
32 if (likely(frag_size <= PAGE_SIZE))
33 buf = netdev_alloc_frag(frag_size);
34 else
35 buf = kmalloc(frag_size, gfp);
36
37 if (!buf)
38 return -ENOMEM;
39
40 if (bm_pool->construct)
If we don't have a ->construct() then we leak memory. This test should
probably be moved to the start of the function or deleted.
41 if (bm_pool->construct(bm_pool, buf)) {
42 hwbm_buf_free(bm_pool, buf);
43 return -ENOMEM;
44 }
45
46 return 0;
47 }
48 EXPORT_SYMBOL_GPL(hwbm_pool_refill);
regards,
dan carpenter
next reply other threads:[~2016-03-16 19:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 19:50 Dan Carpenter [this message]
2016-03-18 16:34 ` net: add a hardware buffer management helper API Gregory CLEMENT
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=20160316195012.GB20386@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@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