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 E8778A034D; Wed, 23 Feb 2022 03:36:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5CB040DF6; Wed, 23 Feb 2022 03:36:45 +0100 (CET) Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) by mails.dpdk.org (Postfix) with ESMTP id B640F4067B for ; Wed, 23 Feb 2022 03:36:44 +0100 (CET) Received: by mail-il1-f179.google.com with SMTP id f2so2678894ilq.1 for ; Tue, 22 Feb 2022 18:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rWQjRe1N35MnB5dzQXaxdWUM1ZZTer596E6Vqrs4N9M=; b=RioJdbQ4oo9bgQmOTc17VSd0k8oyx0mGEsszEz3zwHAPtAUC6Hmymyea7M+tGy8w+4 oSmfFLUHqFz6JdYSNoSLbNJSJuSjgUwMQXEphvKxml1HAQDOgzdiwBGSTL4SxvGnH4YW m3D2Hk6RTvgV0Wq3ei9hZ+mSHGnuCLNy1NnjE= 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=rWQjRe1N35MnB5dzQXaxdWUM1ZZTer596E6Vqrs4N9M=; b=tDrEzgiuvVsEzZfp+A4EJ5QI1h0+farEV5KaBHObMOFhSlRzfl04Me9vmzmmswr2YT A8SkL/HBVRnpPB/n0Aq4yRL9LKhTPrq+Ueoz2Vipey0w/6Z45zNXTdxNAaAQdXYm3VGr yaKbYA+0mMrTdKedKcYREtWqIydi8jAqkm+zF8XCnto7HLZefhEoyqOgwDjodfcIDix8 yvqGCecE253YPRu/2DpQx851gF6eSFLP+GuAorepZ04i3PyMN1Z03WqVfYKvbXVCSn7k 05xKSTwZWISKpcJh3arSeHz1VG4+HzaTrogwc2dLu/mnKOAH9y8ql4TdZRmei56gBON9 x98A== X-Gm-Message-State: AOAM5330DqHPZaG0PzFNC5ZJA/vEFXe601pvLhrqO917RZWiu3ad448f On+UL1xHURYX4dkQMjMT7fTp1qUX4vbGsYdzx/guqw== X-Google-Smtp-Source: ABdhPJxkiXzAaqpYBWGRASpDwLaTgUOroXTogQ2OOQuJ7dLMxEbWO8cgl9I40XGmSqxEDFuHiSY+Q7XpWr9rHgdg8OE= X-Received: by 2002:a05:6e02:214b:b0:2be:ff52:adea with SMTP id d11-20020a056e02214b00b002beff52adeamr22569779ilv.255.1645583804035; Tue, 22 Feb 2022 18:36:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ajit Khaparde Date: Tue, 22 Feb 2022 18:36:27 -0800 Message-ID: Subject: Re: [PATCH 00/20] fix memory leaks in error handling To: Weiguo Li Cc: dpdk-dev , adypodoman@gmail.com, Xiaoyun Li , Tianfei zhang , Bruce Richardson , Ivan Malov , Jakub Grajciar , Harman Kalra , ying.a.wang@intel.com, ting.xu@intel.com, simei.su@intel.com, Qiming Yang , motih@mellanox.com, Shreyansh Jain , Satha Rao , Stephen Hemminger , Kalesh Anakkur Purayil , Somnath Kotur , "Doherty, Declan" , Akhil Goyal , Nicolas Chautru Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000001aabbf05d8a6569a" 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 --0000000000001aabbf05d8a6569a Content-Type: text/plain; charset="UTF-8" On Tue, Feb 22, 2022 at 10:18 AM 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 + ACK for bnxt patches. Thanks > 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(-) > > -- > 2.25.1 > --0000000000001aabbf05d8a6569a Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQdgYJKoZIhvcNAQcCoIIQZzCCEGMCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3NMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCz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