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 F19E1A00C2; Thu, 3 Feb 2022 04:38:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 80C5941199; Thu, 3 Feb 2022 04:38:19 +0100 (CET) Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) by mails.dpdk.org (Postfix) with ESMTP id C5F4E40151 for ; Thu, 3 Feb 2022 04:38:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1643859495; bh=zBVqN6t50lGWfOM38llWkFuP9e5bDjZIif0SQRrl8PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VCdMPxscnS3El5nj1nYfzwXi+4CzdZjCrkUVJfkdqQ9vBe0j4GaCEiSHvKYkDss9D OmxZsdfXKuCnWmzOWdSlZR1qHoR3QsHnZVP4gmcNU9Swuzt+t5rhO+qtYNAsMHQuaU DCsTKao0cjsnVFRVWztRGtzvNId7wfaPJOg53bfo= Received: from liwg-ubuntu.lan ([111.193.130.237]) by newxmesmtplogicsvrsza5.qq.com (NewEsmtp) with SMTP id 9879F895; Thu, 03 Feb 2022 11:38:07 +0800 X-QQ-mid: xmsmtpt1643859487trbz6ge88 Message-ID: X-QQ-XMAILINFO: MntsAqBg2ZZ5BJqCrZk74/0eSQZWHqZMfYcWOULYDu3XFP66Tn96dApihMwGjs bZnDEBTuFSS+KjHF7MdNl+r6NNE6NmN5+s6M7y5Fi2sMzs99cvGpFLUa06HE/6r6LFpotMMNGe8Y z1ufI0ZGPvHkGYK31JRfrL8r4ux9lBcPshLkXt/yzzY+PPpEEGDXoUdKVNd438aQVmOvaAQ/1JBd maDYcGs46U44Zumsr6O708wEmoMo/MurffyyZd4PN3B332pdopCnCgeew4PlJIf/YIb2qMZImA0G dxSPfbYqC7mQtC+R4saGx5L4FEKZnoz741NHvrBqcd/2tSx9BKWCSbF3y3hsc5TWqO5N87Rjy4zJ x3QmxyIhJbMln8EgIbSgp5JyIbr1Xs5krG6mJnitSYmOzdJyVu58X1Ux81l1p/qarO8KoaOK693t Cj2wdD668CJ82yAENWufaMBIcfdaqbKuKdbNkWGlgQ4X4BOiv2YHY/DU0Moim6+N/28MTjs0h6De DTAtfrlGPAEcnYH/vHlmAaDm4W5eCp2SerfvnN4jg6/75b4crX8APAqspBcAVWTIiCkuB+1xYi2h r7S5eXkJNxS73MWqJCR/X9Gj2YXuE1kvRxxS/LZb0oM5gA7wrN6cq5j4ekajOtuZJfXW6InEfQHW A3BwVFUQwYU9cARHjwsoJT95ZOOi19GIb6jVvCMEru3nHq0Yw2wN9+bMzvUw8oF7NjmrBPlY0MS9 U9jpLbsNd9G6YAM7SC842ziqZC6OVdCZRnpKDuPNO/TlPHA/tSAQiESiohzu7PBxHxh6OrGSFpZG J/v+q5VyphBcoUVtpLj5txDVY91mQWnp6MWoIKFFZ6VqVwL0/9wE96Y+ADZn1wTzkenp6qGWrEMZ fPtqagRNQDWxiavXlWjvOFwU4K33w6zT30mAUrSI8W1QNvkDWhPS3T51cJimf30+e35RyT913Y9T jY8Yh0lvDSf0eFesu+WI0pEBKVyw0G From: Weiguo Li To: ganapati.kundapura@intel.com Cc: jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com, dev@dpdk.org Subject: RE:[PATCH v2] eventdev/eth_rx: fix memory leak when token parsing finished Date: Thu, 3 Feb 2022 11:38:07 +0800 X-OQ-MSGID: <20220203033807.1821255-1-liwg06@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi Ganapati, Thanks for your reminding. I'm a bit confused by "eth_dev_id validate" you metiond below. I'll post a new patch for your review if this make clear. Thanks, -Weiguo > ------------------ Original ------------------ > From: "Kundapura, Ganapati" ; > Date: Thu, Feb 3, 2022 00:47 AM > To: "Weiguo Li";"Jayatheerthan, Jay"; > Cc: "Naga Harish K, S V";"dev@dpdk.org"; > Subject: RE: [PATCH v2] eventdev/eth_rx: fix memory leak when token parsing finished > > Hi Weiguo, > Also noticed that usage of macros like RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET and > RTE_ETH_VALID_PORTID_OR_ERR_RET to validate rx_adapter_id and eth_dev_id returns error > bypassing the freeing of memory get from strdup() in error case. > > Thanks, > Ganapati > > > > token = strtok(l_params, ","); > > Validate token > > > > > /* Get device ID from parameter string */ > > > > eth_dev_id = strtoul(token, NULL, 10); > > > > RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(eth_dev_id, -EINVAL); > > Use RTE_ETH_VALID_PORTID_OR_ERR_RET to validate eth_dev_id I looked up the macro defines: RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET -- use rte_event_pmd_is_valid_dev() RTE_ETH_VALID_PORTID_OR_ERR_RET -- use rte_eth_dev_is_valid_port() If you mean the validate of "eth_dev_id" here be replaced by rte_eth_dev_is_valid_port() ? or both rte_event_pmd_is_valid_dev() and rte_eth_dev_is_valid_port() used to do the validation?