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 A391EA0546; Wed, 28 Apr 2021 17:14:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A95040697; Wed, 28 Apr 2021 17:14:07 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id E340E40147 for ; Wed, 28 Apr 2021 17:14:04 +0200 (CEST) IronPort-SDR: fWlvo6ZKAFWoqBbmihjrMqj6Cc90GpCTTBApVPX+lMTOtWgE9lna63tc2ALtKIJPRiZaIO4AXO ozHw6SUU/c6Q== X-IronPort-AV: E=McAfee;i="6200,9189,9968"; a="194650529" X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="194650529" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2021 08:14:01 -0700 IronPort-SDR: 03j0x6SR9288YZzbbEJ5TZR07CdlOXc2wACzBavA5Ozd53921dYzdXAjS8WmuZOEB6x9dRUBTC FTwsBphxQFHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="619346942" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga005.fm.intel.com with ESMTP; 28 Apr 2021 08:14:00 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 28 Apr 2021 08:13:59 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 28 Apr 2021 08:13:59 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Wed, 28 Apr 2021 08:13:59 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.107) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Wed, 28 Apr 2021 08:13:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a1Z0gQjES2k+JUzF+EMX8u0PxFA4mDIXMCrlPxnn/XNhzhHDuJ21G0wX4osVrEov1trFUfnTB8SNiItHkMbfUe/javmpHjUScPwTnH/XiD1WgOEVh9KoCPbLBFjKBB86xt9WEE80JS47PD67pT5Rf4zOlo+GnHn/KV1XqVyoU9dZI9RTFJpzrlzfTj5FeN0B6HoGdgU65DuvtxNaKCWRzB09H1qC66PTB/UQxq52/bcJvNY6nrvjHbocrW6Vordypq6qIGpi5B1D/6lH/NZSYqr58IXXBr/rSe/cO/HbJjfzkjMR6URbJnaXIPCfOz0RoKtj2xqL9ILNjNol2mM//g== 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-SenderADCheck; bh=QU+POC+4QOVts6gWYQrW/w3+fclRfnmVHhUL9NrZ4G8=; b=nXDGcnhnTc6dnVaMzoVfslNXxVtAIWPj0ka34ik31cEYyLo/2QMpDdes+0hQ5IrLqgjjt5qm+6jLgCRa7Eo5LysdT5b843gl5SRdf54n6Z1Gnctn6eEcq8eWrY5Q4pXcBqvG74hYip22lGK4T4s1/8k8cigkuYGFJOy86ql4+CGXjFyGdilOVDEa9guuY2NIjXvCtzJJKf+OulZ8qAEYCrkX5PHWKEbXBH1tQkR9eLLOFhA+iSoU2086q27eOOJ6+MYvhho75+xsVohHv5x7Cui/hThEOb/TQpvvQ6XAOex+UM8S/l8V4kGfHZQxvVQc3xW8F+QWknMG60WnQwN5jw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QU+POC+4QOVts6gWYQrW/w3+fclRfnmVHhUL9NrZ4G8=; b=GoasCPv4UTat2TkM5Qec0SU1ZFl5I48Q2TdK7aXym2SXywf1vuEUgos5O317c3pqELVogJ7p1De45r7jZuwmbUnmjV4c9oT3npEWRSSu3OY7haSRUPS/wngiZhCepmUkY6+aaLioK4WLdCDm5YG6NxdEYyFEHXgJJcYbaXNdeqU= Received: from BYAPR11MB3366.namprd11.prod.outlook.com (2603:10b6:a03:7f::20) by BYAPR11MB3461.namprd11.prod.outlook.com (2603:10b6:a03:7b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.27; Wed, 28 Apr 2021 15:13:56 +0000 Received: from BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::1065:c305:763b:f8a4]) by BYAPR11MB3366.namprd11.prod.outlook.com ([fe80::1065:c305:763b:f8a4%6]) with mapi id 15.20.4065.026; Wed, 28 Apr 2021 15:13:56 +0000 From: "Pattan, Reshma" To: "Min Hu (Connor)" , "dev@dpdk.org" CC: "Yigit, Ferruh" , "Hunt, David" Thread-Topic: [dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check Thread-Index: AQHXOdMPljYoJ1Rd1kOw9mvwWLCsmqrKCycQ Date: Wed, 28 Apr 2021 15:13:55 +0000 Message-ID: References: <1619355594-15223-1-git-send-email-humin29@huawei.com> In-Reply-To: <1619355594-15223-1-git-send-email-humin29@huawei.com> Accept-Language: en-GB, 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.5.1.3 authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [93.107.9.168] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 06d91a9a-edcc-4213-329e-08d90a583dd3 x-ms-traffictypediagnostic: BYAPR11MB3461: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2449; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wfPAEfEVayGoq9TuS/lX7JI63Nm9Ut3W0Uq7S+W3XN5D+hZfkfZS0Zh1+GlWQfRD6FfO2gCDucybLrxJx0J7YpU/q3mx0k8ydwyxEMOM+FddLvP2vgJJfIT/GSC62+UpnbfeeRMJFL90x0XDqtyCdRB1jUzewfidF4VmMVCAAVcDwAY9t9p429LGRrruq5HPzU0mkgzVwJjb2dubqukSCTcdvd08hr5sXsXYAHj/FC8ddQ27iNOw21xiNuU0EbNWeLu4MLa6+IVDw1kB4aCWnHqTuT1pyk1vromfS8xQ+06Jb2GHKLsJAmMpyiiFbDR0Fir5iYbrfBmscgehPz4BfyNT+MxqWmUbWHfrynegX4+xTFs4R4Fq+1gTy09bVJvOrQfvpHFX6itzGcKXXK2KLrWm09LO7/IuvE3sSQgteF9m5nIW5XsK0/Un5F5AuipByubJuQ9dhq4k8A95PFhBbsXi7RUteFjX+D1kntmzz/0LxEZz7h9egbFZXW5cgsIEEPnh7ZZFQ4ua6K1beVk0oo48rtjNe1heDCkjwRi7CImhcxjx4CRk6gTExsv+NaIfirTX9MtoBs+b/Qa+5BXjhBmzk23ViNMchbNslszYZV4= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3366.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(366004)(396003)(376002)(39860400002)(136003)(55016002)(26005)(4326008)(64756008)(66446008)(316002)(66476007)(76116006)(66946007)(110136005)(66556008)(83380400001)(9686003)(71200400001)(122000001)(38100700002)(8676002)(8936002)(107886003)(478600001)(54906003)(6506007)(4744005)(52536014)(7696005)(33656002)(2906002)(186003)(5660300002)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?byLNaFCPQJqCFNYjaBAacCfIMndg+58LtHYRPcJAXmINTCDVlzBTf9Nnm9aO?= =?us-ascii?Q?R8ix1JJkY3v1a/gHGGFISvnyyQU6NFpNbObuADHk5maWfD9KxTBOKu0cUANk?= =?us-ascii?Q?NT3LKhE606wmkuXflKFPdcMJ9OrdsH8qyyFEJWVlXac//YLe9839gn4+BQ77?= =?us-ascii?Q?DO1QFswYfEYDY0Emkri+nknH7Ia2c6CuBhKw14V6aWgI6vPaiPfWFMUR/b0n?= =?us-ascii?Q?whwRHQWssR7e+lcjMNiAf0+BDdYmMbMpETOtJa1cHJoSDg1zD9qGDKZWyVpS?= =?us-ascii?Q?EWCaED8e/bDxrQn+RYd8IyZ7z3/drGdbn84VTDSeXMCC4uKmC53xrNRFWZpy?= =?us-ascii?Q?p/zDrLvcvIZOdI48ROb/GDDbf55J0nGuXUL/mJ6FYvtNi9YmPv90l59kVIEQ?= =?us-ascii?Q?Ab6EgBWcfQHyEdVKsPI0+EHwknK7mBnPx7Uk9gyPxzACMuQfdh1xfuMCt3UJ?= =?us-ascii?Q?Wbt2lBM2Fr/AxNcpTEJADPq0f443l/R45l7uxridJEQwW5hw+WBA2JirVeDH?= =?us-ascii?Q?kBhIo0jq+ULRY1D5qPc2Z6f2PP+Sec/Ji3uLmXoHJCU2dEHGdsI38UFut/a+?= =?us-ascii?Q?A/Br8dEXyiSFZ7cefXEsisO5axMoxKJN/Pr5K7qNu1VmfpFskSKujzZQjsD8?= =?us-ascii?Q?S3p86GVDmobWVQ9k8h26nBPStIU42fG+uG8D+w5JYgHHwhZFahIcwJZFmrqe?= =?us-ascii?Q?wlBJiQUlJTtM60tn0N5ybRRj3oHB5c1K7gpRBonca5WaaMGIKrkAlQmTMU38?= =?us-ascii?Q?Qtvqvdg87j2D8tGimAwzIJ/K3j/+qffkU8xdxipwMAqySCm+bDCEnLbnVHKm?= =?us-ascii?Q?2oeKRcJZ1Ji2KieCf+WqAQXuh8dNPGSRmg7mqiJJibYbcjOqTVamr8Ye0hNr?= =?us-ascii?Q?Ya4SnKuLPw5nkNFK2l3gnoqRDVDz5FffrOaupL1E/STVi4V7BZPIjaqcGDFm?= =?us-ascii?Q?eaGkCTSQI34lUTU39tdk3sjvmIip/a0Hc0a/06FEbGx/kR9X5NyMsm+FHzrw?= =?us-ascii?Q?UskmndUHXffGngkr1oEl/mNuOkY1Azh54Emegpx5JJY8mC2RCUofKdtfJE5+?= =?us-ascii?Q?wDCauZ0CRtjun0MoBnYUknzjyREO2+vVU9ZzjCp7uhbf10eEJKnsfe5jrTEz?= =?us-ascii?Q?XRN2WrF/G2+FrlgBoU+9Xrr9YDa1omv8MB2S8k+MZOzJbTVOhvNyyCFxE2fu?= =?us-ascii?Q?r0HQQMwaPfb4G0kYJqbi4WZFxwkEUWRvo6naj59IsxEmMCweMJoL16MJuGz/?= =?us-ascii?Q?S9ZeZIH2wi5yLXBA3SOgLRnaSBtAIs9pnm9fMlHByDpme4oNAYuzGv9ZmOPB?= =?us-ascii?Q?+14=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: BYAPR11MB3366.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06d91a9a-edcc-4213-329e-08d90a583dd3 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Apr 2021 15:13:55.9307 (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: 0TIqcUnjtsrAkwOdiQoCaX9bbgD+gbLmq8Ztie81h9Ve0HlYJo+qltoUTFGdPmcUirkFHZu5ZXcqZn7wKSzHAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3461 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check 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 Sender: "dev" > -----Original Message----- > From: dev On Behalf Of Min Hu (Connor) >=20 > + if (lcore_id >=3D RTE_MAX_LCORE) { > + RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range > 0...%d\n", > + lcore_id, RTE_MAX_LCORE-1); > + return -1; > + } > + This looks good. > fds.fd =3D global_fds[lcore_id]; > fds.events =3D POLLIN; >=20 > if (global_fds[lcore_id] < 0) { > RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not > connected\n"); Another suggestion if you would like to improve the code, is below, You can move "global_fds[lcore_id]" check to immediate after the line "f= ds.fd =3D global_fds[lcore_id]; " Reviewed-by: Reshma Pattan