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 935B5432C1; Tue, 7 Nov 2023 07:55:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7DBAC40E64; Tue, 7 Nov 2023 07:55:54 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2059.outbound.protection.outlook.com [40.107.220.59]) by mails.dpdk.org (Postfix) with ESMTP id C2DB340A7F; Tue, 7 Nov 2023 07:55:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MjqRA6tmYEgLAHVLVfMiXZCEkfBhguzUvwdDPfL6sr9T7ol2HV4PHajQMRSx4VpD9StKrGU4f3Rz9rMiCR04VfJS6bZDNGV6z5zT3pE5gj9uYbkgnWud2I6hJ1A1HIIg2OwvO/d0ty/J4iv1vYNVoUT/8EgureVEgyRuXDzSeMIAiGDuppdW38o11bZ2L8HsQKTRSx4nBqT5trcl8Or2zOcmiEmxGCa7pLrgh1cHLYSWng/XqXkCS/5/NFzUHZ1+tWNYpbXk8V4hOlcedcCjm0SmKUe0yApBDaF19utyziN/vsxBPvhz2MxW7HPkVeOhxEaPiuVnurx4GFZ+25HO9g== 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=/cEuH9PgBubMHOMCu42KF0Dv4jP16LBrkbMk5T3vqOc=; b=kE2JAahxIjhpHxHKZPQNPPHe/Zcb43xaxmIrbNUSwne8gv2rDgOlAzSp94NwaCT69eec4oxbbNLp9J/wCsDnbXlOp0fNZSKKCgcssHAUB8hFhHeRknCK+1ZLLWKO03d3KeCD4cF0p5GwXaEdkB+PTu1/GwZrx7lDxgSMxtMKfQbR+ImurMutTGKIrogEoakb93CWPweXMKGZ5tqJhlTXxFHCrr1//wVpASKBbfn8QtAvFULV0EtoCIdSBeOGGqODf10JGTqoJaSiqZ8S//A0N6AGyYG9QWgq1ZGOyi6uD0ue6ZSWqB4t5waeqaFga/6jquFdaEt8WQPav92MPisrsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/cEuH9PgBubMHOMCu42KF0Dv4jP16LBrkbMk5T3vqOc=; b=kQ/u299W/uSemmtmT2cZUPn/Mo79HlYlk+innufMAO/Jc0cq0+JREqNOYTR+YXzSauR7KtFR1r4a1DW04N8o0m9SKNljNRLjM38OrqGKvgfhSMOBpLoJdrxO7w/stiWJOJfAqdBNO/HY6UzXssOt5FXuJ2Y8rB9nB8JWrOAp38K92sBAPN9venWJlR5hERRWYX0DZ6P6hyo8aSItHoPgvPRKwEc8HSIS2H1R8e4syuKevZ+7idKctjVD3LLfwL16S8/0LMna2hol/erfGYwPPLTyLfDJfgRfD8VTsyVO87PDOWP68tOGKUM5dw5dcY3LowtEx9R1S+eyECUv5PKigw== Received: from DM6PR12MB3753.namprd12.prod.outlook.com (2603:10b6:5:1c7::18) by PH8PR12MB6891.namprd12.prod.outlook.com (2603:10b6:510:1cb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.30; Tue, 7 Nov 2023 06:55:51 +0000 Received: from DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::5fd9:c0c:398c:7dfb]) by DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::5fd9:c0c:398c:7dfb%2]) with mapi id 15.20.6954.028; Tue, 7 Nov 2023 06:55:50 +0000 From: Slava Ovsiienko To: Weiguo Li , Michael Baum CC: Matan Azrad , "dev@dpdk.org" , "stable@dpdk.org" , Weiguo Li Subject: RE: [PATCH] net/mlx5: fix null derefrence in mlx5 txq start Thread-Topic: [PATCH] net/mlx5: fix null derefrence in mlx5 txq start Thread-Index: AQHaDtRZskyCIbsK00avpZNC3buuT7BucHcw Date: Tue, 7 Nov 2023 06:55:50 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR12MB3753:EE_|PH8PR12MB6891:EE_ x-ms-office365-filtering-correlation-id: 0c1555b4-3a6c-40cd-2e14-08dbdf5e942c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kAE7+tcDyfc9ez5VZL6LeNy0iDlvwr9JC7m5SUo7D4f4eK0SgepWJki118NFjYSSLdhqdgL2ah26CvK/Nm+dguib7vkqaUEuzCjfKakqq6Pyo6zH88FaqI+4WaO+7Ml+wklZfk7GzsGE7xleY2allnsM0sO1YorikcwodG+oPnpk1Qkna9iFupe7ub1ilzCBMhEdtuOzRMnCtMzxsjoXsrQWRMFW8RKyRkIxC+ne/d5xG7ZCaj23l7XejiaWPNBmf41WgtSiYBbV494nJzuQdWXF0CKBO48nFo5kGSjjkr2d+zFrAZurpgDH8LrBclm3LkJcQiMvsxAJYLpN9pR13X4MlaFi2hfjHps2nCnlXzNos6k4k9ombeOJu9hqfpGZJ6ka54DCFRCJO+PFZKymCOJGGM21kUZOZJ/3Eex1p8pmBva1cR41Gl8Re91oEqXcXI4fiGnaKf219KOPY+QZ3IQt/aHpyJgifYnGA2MSi9xaYZXlVBI9ayROaehyJYrzp9wobeSB908mdL/DQnBKvUmtIiWlWNMDWbwSmouHxhr19J6dWRWpWCIxbONHwWZEXCe9I9mXC3LrXj0HgZni76Z8G4L1osKmtRgydIbImgKlWL/rBViqXIZWuqhpV6T7AQTgJ/37bm4osYAoTK2ySryUUaUbgXjthL/Qu2RezLc= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3753.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(396003)(366004)(376002)(346002)(39860400002)(230922051799003)(230173577357003)(230273577357003)(451199024)(1800799009)(186009)(64100799003)(86362001)(38100700002)(122000001)(55016003)(38070700009)(33656002)(71200400001)(2906002)(478600001)(53546011)(7696005)(6506007)(5660300002)(26005)(9686003)(52536014)(4326008)(8676002)(8936002)(316002)(66446008)(64756008)(54906003)(6636002)(66476007)(41300700001)(76116006)(110136005)(66556008)(66946007)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?GdCSks4cuu/NduKsYWdSW4eQlnooc3wxXbkHhPghhdAbsHxz9H+vr6sKz7ge?= =?us-ascii?Q?bwm3IZiPXggsbDkn0FgJV9OUVx40z+6lDYni2GGU3mMlbx8k9dvFQQdB1xzf?= =?us-ascii?Q?MCcIdKhYs1J/b2agb8bySZP/kma3Pl9yPf+m/C9U3NNm6mdQjnyFSOhH1ptW?= =?us-ascii?Q?UzbfGRHLVjCDhFIul1nKev4J7cD1cdpwsy3ak2FyyDr4CUeW462VMK2J/C/B?= =?us-ascii?Q?BNkiXBa1ezfPcjahcEARj5cJOSpXQ4Z6ZJT1l6LUsYoDkYGgSiQIt0hlUgX9?= =?us-ascii?Q?X3NnaOh5WKUGDrx1oM1671vw9dlqL+aSYa9JacWOc8hq+NlwQTfEDT4xt0b/?= =?us-ascii?Q?0yvvdk4Tll4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ascii?Q?sfE1RtJA/hZj55MfjXa80logkm0rXBHZwQXTu9lhuaRaPZ/xTm/G1Ns2NfCB?= =?us-ascii?Q?Dg5EXS66Bx1wXvQ+NiwXcXlXH4RrJSvNek7tgq1EU2wfEz2tMIxtGMCbv+vA?= =?us-ascii?Q?XVsbrepJwyJtTaiY/RVMYmMfnwNsBOAfK2vrItC9hZwoRbxCDZqVekpFKrM/?= =?us-ascii?Q?1/NM+fJulGtQbh2JyrSiP2kHH1uGgCphgjCkPfvS9OHJwNGSNBinGZS+Av3k?= =?us-ascii?Q?zt+shoK9flXubMFeBxDncNIQlmxXggE9hgbcUZEVgc9q0010eTRU7E8qoOBk?= =?us-ascii?Q?F0s5kvTfJXsivUtvvPLdUcCb/vsX597md6hMQYVE?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3753.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c1555b4-3a6c-40cd-2e14-08dbdf5e942c X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2023 06:55:50.8808 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: BKNKVghO4qToaDDKJlE2MoPPtvV8ny40lLNFTZyTRXoD+AyDdg3JgpLLwolCeGwQr55B0np5Ukp0we5JAv7pWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6891 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, Weiguo Do we have some compiler's or linter's warning about the "dereference" ? Actually it is not an issue, once we get txq_data pointer - the NULL is jus= t added with some offset, and there is pre-check before using the pointer. And, please fix the typo in title - "derefErence". With best regards, Slava > -----Original Message----- > From: Weiguo Li > Sent: Saturday, November 4, 2023 6:06 AM > To: Michael Baum > Cc: Matan Azrad ; dev@dpdk.org; stable@dpdk.org; > Weiguo Li > Subject: [PATCH] net/mlx5: fix null derefrence in mlx5 txq start >=20 > Pointer 'txq_ctrl' was dereferenced and then compared to NULL. > Change the order to keep the logic consistent. >=20 > Fixes: f49f44839df3 ("net/mlx5: share Tx control code") > Cc: stable@dpdk.org >=20 > Signed-off-by: Weiguo Li > --- > drivers/net/mlx5/mlx5_trigger.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_trigger.c > b/drivers/net/mlx5/mlx5_trigger.c index 7bdb897612..0741bf627d 100644 > --- a/drivers/net/mlx5/mlx5_trigger.c > +++ b/drivers/net/mlx5/mlx5_trigger.c > @@ -54,11 +54,14 @@ mlx5_txq_start(struct rte_eth_dev *dev) >=20 > for (i =3D 0; i !=3D priv->txqs_n; ++i) { > struct mlx5_txq_ctrl *txq_ctrl =3D mlx5_txq_get(dev, i); > - struct mlx5_txq_data *txq_data =3D &txq_ctrl->txq; > + struct mlx5_txq_data *txq_data; > uint32_t flags =3D MLX5_MEM_RTE | MLX5_MEM_ZERO; >=20 > if (!txq_ctrl) > continue; > + > + txq_data =3D &txq_ctrl->txq; > + > if (!txq_ctrl->is_hairpin) > txq_alloc_elts(txq_ctrl); > MLX5_ASSERT(!txq_ctrl->obj); > -- > 2.34.1