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 E9385A00C2; Wed, 23 Feb 2022 18:43:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4FE740E5A; Wed, 23 Feb 2022 18:43:02 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id D28F340DF6 for ; Wed, 23 Feb 2022 18:43:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645638182; x=1677174182; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=LHIqadCX30n2Lz5TB2TcFv56KcbUl5u+N+R6K4trb0s=; b=huMYHq1DXmhTsjGGTtl8MFEAim3Wg8MUPLh0TtSJtPQfX63VT2oT3+Br FTqrKy6sTk8P59tihRoIpF2ZpJpQfzZMNdT7WWFUt3GXr9Mdq+ioqZhfn EyYbVOD6ZKJpIkvrBqx5MG1AuE9G/9nJXVTj/Jp3mwUVC7E6wwXCA0n7h 7Oj1+j4OvqH5ps9ggRsWS235Ww1PERGC8VzV3jyu6EG1qF1QQwSXIZ5yO AxneyIRYFNVwmawGJhErxOZ2klNZ/EbuNR96Gp9voTl0URe0Eh5B65brD MBszLDpPeVl3yrYfLLWyVKpKiHKnSx26XaXUxTesnxNH5r1Kj9RXtcmJO A==; X-IronPort-AV: E=McAfee;i="6200,9189,10267"; a="239429216" X-IronPort-AV: E=Sophos;i="5.88,391,1635231600"; d="scan'208";a="239429216" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 09:43:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,391,1635231600"; d="scan'208";a="683987184" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga001.fm.intel.com with ESMTP; 23 Feb 2022 09:43:00 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 23 Feb 2022 09:43:00 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Wed, 23 Feb 2022 09:43:00 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Wed, 23 Feb 2022 09:43:00 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nwe0xyWPUQkkxZx1lLstaxl6yxumxY1cG+4zToOxS+8pP4pfxr6OglGkhUj2Er6CJl5wT8MFNofWmRq+DEFZlLs3uHcAp8jhtNA+V2HKsQ0XKrKlhiDAJAiUenceD+KTKMpTbfLI66eF54BZ2h13hSN9lH3y/m6Sj+pYPxUxl6ASnYcWwWSyEGM1SlHWRqutSRV/tf7vgAGDIUvWoWiojK15SsAsvzYKwCj7W4oiRINH6c/SRzDkdbK+h7FaoH/+8l1CMUuTn/1X3q8VkPVsipP6MwncmmJdlLypMayUGcxDqrrY9a6p0S/3BgydEmRHHUvov5FQJuuGN8pZ9R/D8Q== 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=WgLF0IKcRwTny5gbRLDBb6sD4bEdb4INVPPssSQMbZc=; b=FFYmogWV3Or55NsfrQrfiQxeP3Klw7geNy6nGLhWW5xo9qiaSjc0oLmvPPVyb3guicZk/ZecOO7K0qsotF73OT7lB2LG20iXOc4dhjACI+cWJOQ6forx4lNR56C5EGH0AnfWOU3sc6TeRI6dVAW5a923+TANmHX1e0bOzUzxdjA5olt0Z/BkX/ov1PtkcOSkJzxMA1qEGArBEPuCJK2GuFLU6qU66gB7apSGhXZ2RP6fLNiWrZIcfw5Yvp9pmU59PBZcDrdIHzKDA+rjQzvLat4Wv0wsY0h/FIaGeSS/zTLzG2pEEEohrKpj9pdO68BdILTLVUi/fxy7jRH3vOUTHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4457.namprd11.prod.outlook.com (2603:10b6:5:203::22) by BYAPR11MB3605.namprd11.prod.outlook.com (2603:10b6:a03:f5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.24; Wed, 23 Feb 2022 17:42:26 +0000 Received: from DM6PR11MB4457.namprd11.prod.outlook.com ([fe80::1181:b9bf:efd6:27ed]) by DM6PR11MB4457.namprd11.prod.outlook.com ([fe80::1181:b9bf:efd6:27ed%3]) with mapi id 15.20.4995.027; Wed, 23 Feb 2022 17:42:26 +0000 From: "Chautru, Nicolas" To: Weiguo Li , "dev@dpdk.org" CC: "adypodoman@gmail.com" , "Li, Xiaoyun" , "Zhang, Tianfei" , "Richardson, Bruce" , "ivan.malov@oktetlabs.ru" , "jgrajcia@cisco.com" , "hkalra@marvell.com" , "Wang, Ying A" , "Xu, Ting" , "Su, Simei" , "Yang, Qiming" , "motih@mellanox.com" , "shreyansh.jain@nxp.com" , "skoteshwar@marvell.com" , "stephen@networkplumber.org" , "kalesh-anakkur.purayil@broadcom.com" , "somnath.kotur@broadcom.com" , "Doherty, Declan" , "gakhil@marvell.com" Subject: RE: [PATCH 01/20] baseband/acc100: fix a memory leak in acc100 queue setup Thread-Topic: [PATCH 01/20] baseband/acc100: fix a memory leak in acc100 queue setup Thread-Index: AQHYKBiiQfSjwWeGpUG6e2ACi9LGN6yhaDYQ Date: Wed, 23 Feb 2022 17:42:26 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 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: 6646c150-671f-4ab4-ff84-08d9f6f3db41 x-ms-traffictypediagnostic: BYAPR11MB3605:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AbFDvunOizZG+5ZgdYj+NaVUx9vn4E47zX8l+bfOv5z6FFqslJyjdmSJYcQlLBkQvY6YMOWRWltTecBJaSmSMopc+cauU6GPKAJvFHMRTSpFbFNcuwTZ8yATIc4sLe8jdLv4BpfBTJW8AiazI9RDhg4oyQMtjn/NALZ7T8jolzpcqAJX71PIb8hHtJA8vBcostgMP1yb2OtuItymtuXgtQtSgI1nOuc6nJHaqsCBCoybpxaHeP215Fk8atg8r8ause1J7D2y6zQEDV2ktKXgXwTriWq6FoUrBF3ewpwUYFmvCn6gpoD/rFMEB+0wp1Jsg7ziW02GnFrbA8seBkpcXetb28yzD5DCbWQtIb41QeFmHn9V+AoWYxLtURM3oDd1n327cNZ3aRnOXlzGkbaWAmPrMIgqN9ROzjagoRKdJmzHuDAoGiV0xVlyq83jVnkuMIntCvKrwur+1ExZpbkJqt0cExGpnCyV3iVwxTrCv3bjnYkDsiQcelu0eInKpvulnU4eEKWP2I6GgDK/EwEQMPja2OYPzpxydas2u00ciZNv2fBkLMYJ2hEYxz8yrEU5sbuU8MgvCh/mEaW+mGVyoO2X1u4KtziSsxt3E+YPk7Z4f0Wsz65f2BFJghYBrCngAgDv+MoA1UYnjuNvEg6kpbG63C2RTmCFLWjrccodbzh2qBUZsafqTALfoOfsTXFHgRn72o/UbBnji/YA0GTCsw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4457.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(26005)(186003)(83380400001)(2906002)(33656002)(38100700002)(122000001)(82960400001)(6506007)(316002)(66476007)(8676002)(54906003)(508600001)(7696005)(8936002)(38070700005)(7416002)(55016003)(52536014)(76116006)(66946007)(66556008)(5660300002)(110136005)(64756008)(4326008)(71200400001)(66446008)(86362001)(9686003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?e0ULcbxt8SCsySdPh2KS+2imQmCjmCneiRQQeMxYnL9vG6do7boc4UWWWu5D?= =?us-ascii?Q?bwA1fluWOH91h6dnqDLMUgjT90ETFyvrYCFzZsMFBBkcoCwpbB2b5dV2/kdf?= =?us-ascii?Q?vnzkok3p0Dc5aP72LlbO9Zy+tJers+UD+2eEa2m1R67MiV8Y8qCjEEf15Jkp?= =?us-ascii?Q?mSElXBfnWH3xwerZMUeiBvwfeKbpnumzc6qlVwKxZeWwAa3J6BsYQ8X60BqF?= =?us-ascii?Q?MK1uusK2a3Tu9rl+aUEMSddrKrxNKZpJqRS5olW6V8oheXrGKnbWvOZE3iZ7?= =?us-ascii?Q?sqP7PBiDShZIVoEijWn7XYMp8mbljQpFr3EhnskLKnG5kc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ruSutFcBzotrjh2hfP3MeeBxrnFLkFnJ+nbZclLCpxhWo2l7crR49ji?= =?us-ascii?Q?Bp9nlKGfGl2gwnP38VTLuSNEYHKZq6FR4DpbSb1K/Z8sGVfmjRQgQ9FQEF1R?= =?us-ascii?Q?Z5neoFqywT9G1RAIJtwf7vDYhuJlG1pO9n8Wt3UprTTXZmyz3pNhNQ49bbre?= =?us-ascii?Q?Gw+gqBt0Qpteycq4LADLZcRDfvRF9HvJlqXg6ZNRlvAszFrvQoyW1I6GorUr?= =?us-ascii?Q?b5i0JiQgN79sjbB2W6MPjsg/lZMHAm7CJz5xj4uDDQF/ZDdIJfd6U8sAMUOI?= =?us-ascii?Q?grNiMc+UJzJHwUwq5+6ZNEmVXdHYnwhKv7CXlvACTOCO40bXR2K05oa+oaj/?= =?us-ascii?Q?s3IJX9WZU4y/XIpAr2zrTPjhWiGDCx8ZrZ1TkTcqg3Og03IIW3cDFf2I0LNA?= =?us-ascii?Q?doSo8EOhv3EXn2PIZHr3XdPnchco0SluZ3gARTanZ/4rOS/NP4VuahNsl0R+?= =?us-ascii?Q?tHuSgQ=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: DM6PR11MB4457.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6646c150-671f-4ab4-ff84-08d9f6f3db41 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Feb 2022 17:42:26.4094 (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: I4fQ9bjUR1lc+T3tKneO9+g7366OAkjiS53GD+jFUUKDD/ky7sTWFxZCqMBN+hovMgGK0FLDMStczgAA0Ql+QROWNlWxPY5OYqOcJ0T6qrE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3605 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 > From: Weiguo Li >=20 > We allocated memory for 'q', we don't free it when null check for 'd' fai= ls and > it will lead to memory leak. > We can move null check for 'd' ahead of the memory allocation to fix it. >=20 > Fixes: 060e76729302 ("baseband/acc100: add queue configuration") >=20 > Signed-off-by: Weiguo Li > --- > drivers/baseband/acc100/rte_acc100_pmd.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c > b/drivers/baseband/acc100/rte_acc100_pmd.c > index f86474f7e0..25e9e6435f 100644 > --- a/drivers/baseband/acc100/rte_acc100_pmd.c > +++ b/drivers/baseband/acc100/rte_acc100_pmd.c > @@ -824,6 +824,10 @@ acc100_queue_setup(struct rte_bbdev *dev, > uint16_t queue_id, > struct acc100_queue *q; > int16_t q_idx; >=20 > + if (d =3D=3D NULL) { > + rte_bbdev_log(ERR, "Undefined device"); > + return -ENODEV; > + } > /* Allocate the queue data structure. */ > q =3D rte_zmalloc_socket(dev->device->driver->name, sizeof(*q), > RTE_CACHE_LINE_SIZE, conf->socket); > @@ -831,10 +835,6 @@ acc100_queue_setup(struct rte_bbdev *dev, > uint16_t queue_id, > rte_bbdev_log(ERR, "Failed to allocate queue memory"); > return -ENOMEM; > } > - if (d =3D=3D NULL) { > - rte_bbdev_log(ERR, "Undefined device"); > - return -ENODEV; > - } >=20 > q->d =3D d; > q->ring_addr =3D RTE_PTR_ADD(d->sw_rings, (d->sw_ring_size * > queue_id)); > -- > 2.25.1 >=20 Thanks Acked-by: Nicolas Chautru