From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EF2E4A0093; Fri, 24 Jun 2022 23:05:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A17A4069D; Fri, 24 Jun 2022 23:05:02 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id E86D5400EF for ; Fri, 24 Jun 2022 23:05:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656104701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KcH7VygD9V0uNwpnXtCrqTfo2DeG3SsxwSgDT49WAek=; b=bJja55Ew2vm2O1p51/fmboXW1EiR2NygYJ7+dW5DlVmjJxhORmqo6TES3sge/VdBwe57Qg ld//C95xkNClnR00Nc0m5+IQe17zfAfJ/nH96zJY4+IYNuyfpg4eAk/xLYIEPDGcweqkUV t+pEl16kes+MF/u0EqzTXeM62YQ4I5k= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-369-H_CiJ72mPxq6TU_qrgUQrw-1; Fri, 24 Jun 2022 17:05:00 -0400 X-MC-Unique: H_CiJ72mPxq6TU_qrgUQrw-1 Received: by mail-lf1-f69.google.com with SMTP id k38-20020a0565123da600b0047974049f03so1925827lfv.23 for ; Fri, 24 Jun 2022 14:04:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KcH7VygD9V0uNwpnXtCrqTfo2DeG3SsxwSgDT49WAek=; b=JtTQVgQ7vVUvG2P25EG6Hyf8F14UbRKsL+wTJsNzbUlCk0rXjZFTOVAi7wVEXpp1mM 8E7pTv91RtawPxfC3gZX1s1lSP8E0EKfhm37203xZ0XwH6SNsPOgqe21FeWH21T2kUcs xyqtxF7ehV6rJCIN7um9xPQyRySCcEATCUPpWKzAr+Z/pqzvJk+52BgtGwGY4kw+7yor l9qO0nsuA/e6wp6QnWZIfId/5mbq4UEK2B2VlaKq8Ky14HKLBzmuRbklDRnebcjNsEe6 Jrzy2lNOnLUNdB4g4aH1zOKsJ/d5qNQojm7HVOxFdX8uIwc9uNWLDqJUflEXKxdWCW8y +RpA== X-Gm-Message-State: AJIora/eBpdcIdOELrmuioL5PF3IvGGzwgb/X4WSOMg6u9kdUcKuWs12 8lhJg7G7PVpLR7gpZnoanvEa0KZu16UdQcv+E1lJbNjzujjrwXAskiSKu4q30ny/XtcmPJaVbgU AItidLXTgGzFw6p/H8dw= X-Received: by 2002:a05:651c:38e:b0:25a:7182:410d with SMTP id e14-20020a05651c038e00b0025a7182410dmr435075ljp.81.1656104698578; Fri, 24 Jun 2022 14:04:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s9JAPLTbNgwkAjUCwwVcCmzxr2CMZnBudDIctHLw9jLTuO1ZraozhVzUNYty9zEiLLgsDm6Nc6K3bDpPneOhE= X-Received: by 2002:a05:651c:38e:b0:25a:7182:410d with SMTP id e14-20020a05651c038e00b0025a7182410dmr435060ljp.81.1656104698344; Fri, 24 Jun 2022 14:04:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Marchand Date: Fri, 24 Jun 2022 23:04:47 +0200 Message-ID: Subject: Re: [PATCH 00/20] fix memory leaks in error handling To: Weiguo Li Cc: dev , adypodoman@gmail.com, Xiaoyun Li , "Zhang, Tianfei" , Bruce Richardson , Ivan Malov , Jakub Grajciar , Harman Kalra , Ying A Wang , "Xu, Ting" , simei , Qiming Yang , motih@mellanox.com, Shreyansh Jain , Satha Rao , Stephen Hemminger , Kalesh A P , Somnath Kotur , Declan Doherty , Akhil Goyal , Nicolas Chautru Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Feb 22, 2022 at 7:18 PM Weiguo Li 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 ...; > ...+> > } > ) > > Weiguo Li (20): > baseband/acc100: fix a memory leak in acc100 queue setup > common/dpaax: fix a memory leak in iterate dir > crypto/dpaa2_sec: fix memory leaks in error handlings > crypto/qat: fix a memory leak when set encrypt key fail > net/bnxt: fix a memory leak in error handling > net/bnxt: fix 'ctx' memory leak when new malloc fail > net/bnx2x: add clean up for 'rxq' to avoid a memory leak > net/cnxk: free 'node' memory when node add fail > net/dpaa: fix a memory leak when validation fail > net/failsafe: fix a memory leak in error handling > net/iavf: fix a memory leak in error handling > net/ice: goto clean up lable to avoid memory leak > net/ice: fix memory leaks in error handlings > net/ice: avoid fix memory leaks in register parser > net/memif: fix some memory leaks in error handlings > net/sfc: fix a memory leak in error handling > net/vmxnet3: fix memory leaks in error handlings > raw/ifpga/base: fix memory leaks in error handlings > raw/ntb: fix some memory leaks in error handlings > regex/mlx5: fix a memory leak in error handling > > drivers/baseband/acc100/rte_acc100_pmd.c | 8 +++--- > drivers/common/dpaax/dpaa_of.c | 4 ++- > drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 3 ++ > drivers/crypto/qat/qat_sym_session.c | 9 +++--- > drivers/net/bnx2x/bnx2x_rxtx.c | 1 + > drivers/net/bnxt/bnxt_hwrm.c | 1 + > drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 1 + > drivers/net/cnxk/cnxk_tm.c | 1 + > drivers/net/dpaa/dpaa_rxtx.c | 1 + > drivers/net/failsafe/failsafe_ops.c | 1 + > drivers/net/iavf/iavf_generic_flow.c | 1 + > drivers/net/ice/ice_acl_filter.c | 2 +- > drivers/net/ice/ice_generic_flow.c | 9 +++--- > drivers/net/ice/ice_hash.c | 30 ++++++++++++------- > drivers/net/memif/rte_eth_memif.c | 32 ++++++++++++++------- > drivers/net/sfc/sfc.c | 4 ++- > drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 ++++++ > drivers/raw/ifpga/base/ifpga_enumerate.c | 10 +++++-- > drivers/raw/ifpga/base/opae_eth_group.c | 1 + > drivers/raw/ifpga/base/opae_i2c.c | 5 +++- > drivers/raw/ntb/ntb.c | 9 +++--- > drivers/regex/mlx5/mlx5_rxp.c | 4 ++- > 22 files changed, 100 insertions(+), 45 deletions(-) There is some rebase needed: at least one patch on net/ice does not apply anymore, and I see that the fix on crypto/dpaa2_sec needs a rebase too to be complete. I only looked at the first 5 patches, and sent some comments. I don't think the rest of the patches will be different, I expect more comments or doubts from me. It is already late here, I won't take this series for -rc2, sorry. To make this series progress, I suggest rebasing, and sending per driver series, so that those series land in the relevant subtrees. Thanks. -- David Marchand