From: David Marchand <david.marchand@redhat.com>
To: Xiaoyun Li <xiaoyun.li@intel.com>,
"Zhang, Tianfei" <tianfei.zhang@intel.com>,
simei <simei.su@intel.com>, Satha Rao <skoteshwar@marvell.com>,
Shreyansh Jain <shreyansh.jain@nxp.com>,
motih@mellanox.com, Qiming Yang <qiming.yang@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Ivan Malov <ivan.malov@oktetlabs.ru>,
Jakub Grajciar <jgrajcia@cisco.com>,
Declan Doherty <declan.doherty@intel.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Kalesh A P <kalesh-anakkur.purayil@broadcom.com>,
Harman Kalra <hkalra@marvell.com>,
Ying A Wang <ying.a.wang@intel.com>,
"Xu, Ting" <ting.xu@intel.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Nicolas Chautru <nicolas.chautru@intel.com>,
Akhil Goyal <gakhil@marvell.com>
Cc: dev <dev@dpdk.org>, adypodoman@gmail.com, Weiguo Li <liwg06@foxmail.com>
Subject: Re: [PATCH 00/20] fix memory leaks in error handling
Date: Thu, 2 Jun 2022 10:06:13 +0200 [thread overview]
Message-ID: <CAJFAV8yKCwCUUdjOa+5O5C2w6ayRD7CFsTN1UQjZvZ9gZzhpBw@mail.gmail.com> (raw)
In-Reply-To: <tencent_3C112E11A018311EA7D3D908771D89EFBF07@qq.com>
On Tue, Feb 22, 2022 at 7:18 PM Weiguo Li <liwg06@foxmail.com> wrote:
>
> This series fix some memory leaks in error handling.
>
> I write a coccinelle script to detect these issues, and
> fix them after exclude a small number of false positives.
>
> FYI, the script is as follows:
> //
> // Find possible memory leaks in error handling
> // Reference: coccinellery/alloc9/kmalloc9.cocci
> //
> @memory_leak_in_error_handling @
> local idexpression x;
> expression E;
> statement S;
> identifier dpdk_malloc = { rte_malloc, rte_zmalloc, rte_realloc, rte_malloc_socket,
> rte_zmalloc_socket, rte_realloc_socket, rte_pktmbuf_alloc, opae_malloc,
> strdup, strndup, malloc, realloc, calloc };
> identifier dpdk_free = { rte_free, free, bnx2x_rx_queue_release, bnx2x_tx_queue_release,
> rte_pktmbuf_free, opae_free, ntb_rxq_release, ntb_txq_release, ice_rx_queue_release,
> ice_tx_queue_release };
> type T;
> @@
> (
> /* skip this pattern to reduce false positives */
> x = dpdk_malloc(...); ... if (...) { ... \( return x; \| return 0; \) }
> |
> * x = dpdk_malloc(...);
> ...
> if (x == NULL) S
> ... when != E = x
> when != dpdk_free (..., \( x \| (T)x \| &x \), ...)
> when forall
> if (...) {
> <+... when != E = x
> when != dpdk_free (..., \( x \| (T)x \| &x \), ...)
> when forall
> * return ...;
> ...+>
> }
> )
Thanks for those who did reviews, but there are a lot of unattended
fixes in this series.
Reviews please!
--
David Marchand
next prev parent reply other threads:[~2022-06-02 8:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 18:17 Weiguo Li
2022-02-23 2:36 ` Ajit Khaparde
2022-06-02 8:06 ` David Marchand [this message]
2022-06-24 21:04 ` David Marchand
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=CAJFAV8yKCwCUUdjOa+5O5C2w6ayRD7CFsTN1UQjZvZ9gZzhpBw@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=adypodoman@gmail.com \
--cc=bruce.richardson@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=hkalra@marvell.com \
--cc=ivan.malov@oktetlabs.ru \
--cc=jgrajcia@cisco.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=liwg06@foxmail.com \
--cc=motih@mellanox.com \
--cc=nicolas.chautru@intel.com \
--cc=qiming.yang@intel.com \
--cc=shreyansh.jain@nxp.com \
--cc=simei.su@intel.com \
--cc=skoteshwar@marvell.com \
--cc=somnath.kotur@broadcom.com \
--cc=stephen@networkplumber.org \
--cc=tianfei.zhang@intel.com \
--cc=ting.xu@intel.com \
--cc=xiaoyun.li@intel.com \
--cc=ying.a.wang@intel.com \
/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).