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 90DAFA04A7; Mon, 24 Jan 2022 11:18:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 812DF410F3; Mon, 24 Jan 2022 11:18:12 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 8B58240E0F for ; Mon, 24 Jan 2022 11:18:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643019491; x=1674555491; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=GA7J2UDKU8p3WkhAi9l7PMqnkwXZ/Y0QJ1OT9W3bd1o=; b=Gt8EA078prg6e+hCi2dJNTaAvnwaUnnrP6W8CRtpmlDorohHJvacbisr Vt2Ixkmei3VBjiEE59EdB1XNYG9HL5eA9CpTy17lfASmpEYaXSH4iSNof VsdGHVcmfIG+LcuOYsR7wA9Nk2QxmgTF0Lo+V/whucCw6Diy8n363YJi4 0zvvwTmQ4OMZmKeqCJA9izJV5djCF7IiCAQthoWqxizPamLMe+OozwR+l TXxTklKdDbBT7RuHM8N3UHkHQvbBkGplZ9zWcleWa0FuS5WCqHdpO/M54 h22TVHrOSN2JcbtZhKK7bpUDYoM1f4atRBCy35vlhnEx7tmmTvz5f2VvL Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="225993954" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="225993954" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 02:18:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="476671383" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga003.jf.intel.com with ESMTP; 24 Jan 2022 02:18:09 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 24 Jan 2022 02:18:09 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 24 Jan 2022 02:18:09 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.172) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 24 Jan 2022 02:18:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZIxdK0IZkgFddfvgXoalfx5S3LQ2dPyTRksojdJe6MFe9OZ6xjiz0BzqSp3Ge5PioMWk1VLgij0bmqt2G8W/eQOK10K/U55KoiieLjHl6UYV3sEce92MphpFo6+XYU9NackWtKJ4CnrQi7LQRvfAgG3yIFtM9njyyflO+zCHzaU8uElnyJ4hZ7zKEI19kP1FIf8uncN9gI+Jqvs7QP6tzMdE6lcynH0HBPuoGyqFYoGz8En1pmC7ejs1OD4y8KMn4Jc0sCz341pZCbBIp9JoKEuwAWZghkW6ILDNZOSrPZjBGMypYKfN1RLqrE8RayMOHiJq74odKfQuVeEqu+1T+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UvY5HrXOEtn+Zg5DQM2fIQXCJxO1JNphFnr4a780uDk=; b=RIFGnBnwBrXN/UaNO9LsRxwa3NZtCIF/j4bo5fP7GC68FxkxeXE1UAcM9S8F2UMMz2ylFCy1a1IumHdV6oSrH94OWY35Q5s8xSuDZSLRy6xzMXPTn5czqtMm4ISvpGyVLVWr15fvBLNlVJWLUha40bXPhJ7Xlg8uxvHWzJy84RcFPIVG9tzt/iXHCK/zvV48X/621UGZjjxTV7lZzrnFEN5KHmt5XDH+r5XWzDVnrWn4meU+IqBY0x/xZjM2IlxpdpP/GVF6lVqhyxITEpT65/7s0LIjnbB+8+xngnuy1eogBdW63nhyHuHeGvQNBAQrLt7B2LjsZFtT+8/EjdQuzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM8PR11MB5670.namprd11.prod.outlook.com (2603:10b6:8:37::12) by PH0PR11MB5642.namprd11.prod.outlook.com (2603:10b6:510:e5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Mon, 24 Jan 2022 10:18:02 +0000 Received: from DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::e9b0:843e:2b39:6680]) by DM8PR11MB5670.namprd11.prod.outlook.com ([fe80::e9b0:843e:2b39:6680%5]) with mapi id 15.20.4909.017; Mon, 24 Jan 2022 10:18:01 +0000 From: "Dumitrescu, Cristian" To: Stephen Hemminger , "dev@dpdk.org" Subject: RE: [PATCH 06/82] examples/pipeline/thread: remove unnecessary NULL checks Thread-Topic: [PATCH 06/82] examples/pipeline/thread: remove unnecessary NULL checks Thread-Index: AQHYELZCWDMKNCa9l0C29qK6ddAHZ6xx9eCQ Date: Mon, 24 Jan 2022 10:18:01 +0000 Message-ID: References: <20220124000518.319850-1-stephen@networkplumber.org> <20220124000518.319850-7-stephen@networkplumber.org> In-Reply-To: <20220124000518.319850-7-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.200.16 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 905fc48e-dc56-488d-20f9-08d9df22cd81 x-ms-traffictypediagnostic: PH0PR11MB5642:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bfzK5i3azE15TcLMiBKd7tgaoRzCazCbZNdDiT2fcHW0z+bY1ncVefiUSY9cJ/Jp+QSH1gr6JB11qiz0FLN/kleszW9Ym8pOYaPfYMxySziXGIwNr20MnhqTPGdk6QujM1ksbIK2rfjUGuVMM0kA0FF54ZEFvy4EC5gZIiI6uk0Kb8LGXyB9L3hbhSX7+0EU5NRwszzJ64p+yKo7lgfvWA9l0gZGK9K8xwzsjDK83QMLmO/gTFSB92/40RHEwEr99GcPKdCwPkjsoVfQYeg/iPPQFhl/L63U0kI7cSabRc9OgoCQ5G8j2dtqT7/48OKPIUxwXqQDKopbAYhslzvg505D7aTCXrSAkW6g3Wa27wXtZqQk+XN8nChEYIo5KKbIYCq2zN+MrliMbF10wvbz3hYt6aTqgbEo11wvirPCHKXU1OgjKojfq14x/V+QLAX9PZs6XObTGXgG40qXh9eFSIF2USNA7bQrELNg9dOCLCd3qVqcckGnfWzWL28AzipMnQbed5VhnEusEJKWLcT7NmqdW8kpLN8xoS7e5QgYlfOIcOKphJZOs3NVRfVWcS4vLFEjNVxlLYbcrwqE7/1ynEZqqYOf737Lr627ZmCW0LmZ4gP62f424d8WofWq4CebSgWkTfgO3Jxv8KGMR0yREPYrG/3qA2/tbJN2vyzR2dZsbgjPbYev1sUdSMvOFYnrgDXo+VIyif8mjCaE3Twqsw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5670.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(66556008)(66476007)(82960400001)(66446008)(66946007)(186003)(64756008)(38070700005)(8936002)(76116006)(110136005)(316002)(8676002)(6506007)(53546011)(7696005)(83380400001)(52536014)(508600001)(38100700002)(33656002)(9686003)(5660300002)(2906002)(26005)(55016003)(122000001)(71200400001)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?W99FUTDpsUSry3n5TPOewMdyulKJ0qDn+1OfD37PaEMdeUZoChWmRpjUXPV8?= =?us-ascii?Q?9QdMejPC2QzeitTj3SpIbR6gwXjwwkxfpJjT/nFv98NSk12WIx7nMcW/K+a6?= =?us-ascii?Q?EWg4snBnI6r7k+HRDgBw1YpWC1bDT9p3aKeg0T9BUs+ksjCnwoXrTBl02SU2?= =?us-ascii?Q?MdPuw6os9vSoZ9YNUBU83ndgDU/schbz2tAKUSQOzf530TpqEy+okSGBR61t?= =?us-ascii?Q?zqvl6WlJ1R6GvAkvcT/YDBgltdM+5eUyEnOc/lWHC/Z24oyAqxqNBjhkEULn?= =?us-ascii?Q?WVnhXemjNcuskGOzrrnOeLQ9knUu90BDtt+6HkuNhmiOJft3aKS8GD2+Z3/Q?= =?us-ascii?Q?lmGEB7B62Y3FkxZmIaj4aTVjx1/iRoauhu8bSymwsSHgQd2EIAwwH+kPd3Xx?= =?us-ascii?Q?IZnAl8avcIlRx/Dz3j6zleL7OaR07+/yVqYEeAsdK+xQcdbmETBEK1+uExA0?= =?us-ascii?Q?9os0/u6NCOhGxk6diZTpT6jZtwtQpvw3UNThslbfFrymx8bcAfiv8dra57X6?= =?us-ascii?Q?L6bniWIlSwstwCiUuoRJ7qD/tJiLEoaX2jOodAXMWM0PtBKl+7jH+HOTHtvO?= =?us-ascii?Q?+yrUbApde78iKfeGJUGry4eXqUXaW3UDjyIDkCAbEJMceB+zpfXLlI5G8bJF?= =?us-ascii?Q?oj+uyfxXIBBHK64IxdtNTOO78zYXS859Tw7fCMKlmhq2N5J944RvHCd23uES?= =?us-ascii?Q?eJf5ar7yagAXwrOvrAJzXAK/6PoUsC6wb1TMimViptEQi+SEfIW7H3oOPzC5?= =?us-ascii?Q?7JWbOeixZmDWg+HO918094RV2WbfhPsFAvg34DcySrVIPuE1zcRUhlV/j5PI?= =?us-ascii?Q?OaJ+hOi9GSnBBy2zPxFfvl74/FynKwwDXZp/XnoIlokGuLatWiyiLtAtAtPv?= =?us-ascii?Q?yfSeKspB3SIiVDWtwxI1TJCRxuX/BYJen01lNThkdzqEKtWuHItGDzIYseF0?= =?us-ascii?Q?KGv3n8DqjwSrDqcQdzoe9JnlY3cH0qgomCQSKsebo+W52n879wvxTOC8bE3a?= =?us-ascii?Q?B1q6XuAMP1r2zR99e0WX8P9lZjo/izDxHOevoBfDN/FRXyNEwe6tMS/RDnpD?= =?us-ascii?Q?aWKE5HgabIU2sq3a1BtLF2+4n/HAwE/5Y7q1G4Fq4TPVGimo/z4nLH2LEbYt?= =?us-ascii?Q?zgmcMRRX3kd3KDu3S9tEGi2gB5Lq1DJdYNgbCU/zyWMOQfFi+nE2e7PbSMvO?= =?us-ascii?Q?RvWju5bN6nxxSNZ1KouO7SFjfmFkB9k9wChna2FzGizhCRdWB20WDBvA2F/P?= =?us-ascii?Q?21/d4VDe8xVdAZCBf6smmWHEKaL7lkGQPrtKJO76/SyrueCt/BmQVS0OzU4j?= =?us-ascii?Q?5/OA9mwsUSHrlRWoQDaPfWdGYLcE2lUvaJZ6bCqqfZa8ygswF9+7C+TRkYLV?= =?us-ascii?Q?NQUBERibutCkGDPV80zj+KS+3VRUrqr6Tngfu01rTk7FuO8WK42tJjtWSXGm?= =?us-ascii?Q?H/gyrNMTks388GWp6DZTxDRCkGh9GoJUXRlC7d7v7pumlC1IPU2+M8qEkClI?= =?us-ascii?Q?9BEl1tM1JgcznOoy1Etpmkv88hYiwwgN3cNLEhl1O+ia/jWNEGTW4fySsNUv?= =?us-ascii?Q?Kgm147dhvQXjhDnP42p2KF6URzRIg1tMUuTO4ep4lWgWSVeFM5usSZldqnNl?= =?us-ascii?Q?+Ufg+Onn1X+05xfbcJD7xDDlDAZ7hqZxRrZAfgU2dF7E36NCOBWRP1o6YU7x?= =?us-ascii?Q?I8opjw=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5670.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 905fc48e-dc56-488d-20f9-08d9df22cd81 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2022 10:18:01.8684 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1P5gXJct/IOhNZ6NHoXcCOqdgfQM/Cbeyjv7QT2FD5QT3lyJ6dFyra46j1y+g9Pfz5OAo/3DWQIG3zOrz82X/eaXqp0GteXgF7RbRx/ldf4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5642 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Stephen Hemminger > Sent: Monday, January 24, 2022 12:04 AM > To: dev@dpdk.org > Cc: Stephen Hemminger ; Dumitrescu, > Cristian > Subject: [PATCH 06/82] examples/pipeline/thread: remove unnecessary > NULL checks >=20 > Remove redundant NULL pointer checks before free functions > found by nullfree.cocci >=20 > Signed-off-by: Stephen Hemminger > --- > examples/pipeline/thread.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/examples/pipeline/thread.c b/examples/pipeline/thread.c > index bf11e6144b75..5fe7eae00eb6 100644 > --- a/examples/pipeline/thread.c > +++ b/examples/pipeline/thread.c > @@ -89,11 +89,9 @@ thread_free(void) > continue; >=20 > /* MSGQs */ > - if (t->msgq_req) > - rte_ring_free(t->msgq_req); > + rte_ring_free(t->msgq_req); >=20 > - if (t->msgq_rsp) > - rte_ring_free(t->msgq_rsp); > + rte_ring_free(t->msgq_rsp); > } > } >=20 > -- > 2.30.2 Hi Stephen, The rte_ring_free() and rte_mempool_free() do not state in their API descri= ption that freeing a NULL pointer is harmless. Before pushing these changes= , please add the necessary note in the API header files for these functions= . In the absence of the clear note in their API description, the user is forc= ed to check for the NULL pointer. I agree that the implementation of these = functions does the right think and exits early when the input pointer is NU= LL, but there is no guarantee that the implementation is not going to chang= e. Agree? The stdlib free() and the rte_free() do have the clear API description note= that freeing a NULL object is harmless, so removing the NULL check before = their call is indeed safe. This stands for all the patches in this set. Regards, Cristian