From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.14192.1683855377050351448 for ; Thu, 11 May 2023 18:36:17 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=h17pLNEl; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: hao.a.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683855377; x=1715391377; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=WgIw3ZW1GQCDx3xXxBa8AxW8pZyiyya3Wvv961ATvK8=; b=h17pLNEl5sYEzxgWPbVH+WvGI7v7AHZqNow+iShkNBHHBPI3Mj/IeHGJ G4zorSIrrOxgBBaIGLGp7YX6Lg7JFc76bUfOSpVZEh9TOEK9jXn5tuMa4 fYZ1wSYQ/MsEfhhG8TSJLLSmOkI2QJ3gqiFwpXlqzikymt1Gzz7r5hrCp TTqAUZI6IKBdBGhBIfmE9kLGb+cLENYZVT8fRHJNvRk3LT/0nziCoMLkg wKOzuOFLvv3o0jmIatA5tYKoI/lZhfrSmNxiysnUKzWLnTHLJkqKmCXCv UbBhZfdpGxdkec6tZmgwpvZbwP97cZ8lPEg9FAfzZ518WSi0lcOBtyjmV g==; X-IronPort-AV: E=McAfee;i="6600,9927,10707"; a="353800650" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="353800650" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2023 18:36:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10707"; a="1029860268" X-IronPort-AV: E=Sophos;i="5.99,268,1677571200"; d="scan'208";a="1029860268" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga005.fm.intel.com with ESMTP; 11 May 2023 18:36:15 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 11 May 2023 18:36:15 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 11 May 2023 18:36:15 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) 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.2507.23; Thu, 11 May 2023 18:36:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NMxvTy8miSBqIbIu81mI8szq9e1WjPJCW/UMggAsHzU1XkqA4BmqW7U+FJXyGMFlg4ZUj74zJkigF61i5tTVam8s36r9GID7y4SjJhgyx8Z4tZFaveHS9Qq7yGGe0L38pWU7ftRqS2OROCjcL7m+RXuEvt409ewaKaVlSEnPXcRhf5PoodabHCh23SNpJA3LQT81xmchwEynXCWWdClo236CaAdCdG807U7AUILzl8AC1oVPHqE1ftL1PN/tPSN6Pvo2ZSWzFGcpGiSiGpMZZ7DmXT9HKSd1YrapU/3W37FyqD2IC31kbk6hVrKHVuM+w4n1Po9cjJ/97K87pzgsBg== 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=8iSS2zkJ52n1bvtwrnXARV8wM/GUaQ5TgYevbBu00Iw=; b=IEGq7tawsxH58y5fxONrSnN/mIRPGVBiaERKcG1M62brDaaaqwvXJ2vpl0PxzS/iR+EpX7o0343GgPP3EQ61CXAySi2z2io1zMWwpvMBaD8UbpOYdB+Np4i9YhXMQgqFy+qgH0rlU41i1a/Gam+ASB2KAxW3N7icZ4N/X++k3D84tkJLWCTbLnsrUY8B4okQvBezsFKEWNmbIv4D4DNFZEXQFu23cOmASovm3iG0zlabtDjgS0w8ljrpG6z3kWpkdm8yMj5FZEdfpwMF8kn54O/Tr1zB9Oy4Tths2I6xFx2+nyR2IPy5qJlbFxGhcaPhwMbEgRGhqA0QpLb9Gt1f/w== 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 MN2PR11MB4031.namprd11.prod.outlook.com (2603:10b6:208:150::18) by CY5PR11MB6137.namprd11.prod.outlook.com (2603:10b6:930:2b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Fri, 12 May 2023 01:36:07 +0000 Received: from MN2PR11MB4031.namprd11.prod.outlook.com ([fe80::938:1dcf:6071:ef90]) by MN2PR11MB4031.namprd11.prod.outlook.com ([fe80::938:1dcf:6071:ef90%6]) with mapi id 15.20.6387.022; Fri, 12 May 2023 01:36:07 +0000 From: "Wu, Hao A" To: Pedro Falcato , "devel@edk2.groups.io" CC: Laszlo Ersek , "Wang, Jian J" , "Gao, Liming" , "Ni, Ray" , "Mike Maslenkin" Subject: Re: [PATCH v2 04/12] MdeModulePkg/SataControllerDxe: Fix up ASSERTS (Private != NULL) Thread-Topic: [PATCH v2 04/12] MdeModulePkg/SataControllerDxe: Fix up ASSERTS (Private != NULL) Thread-Index: AQHZgpPquhstrqdHVUmqkacAl+p7m69V3xDg Date: Fri, 12 May 2023 01:36:07 +0000 Message-ID: References: <20230509163212.291333-1-pedro.falcato@gmail.com> <20230509163212.291333-5-pedro.falcato@gmail.com> In-Reply-To: <20230509163212.291333-5-pedro.falcato@gmail.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR11MB4031:EE_|CY5PR11MB6137:EE_ x-ms-office365-filtering-correlation-id: fae3e22d-9b6d-4697-9db1-08db528941ed x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 51/To94OJvI/zkqNYjBJpYLEgFQt65LQPy/n2G817tRY1CkzFq9IFRYcW5JgZ3Yoat8F6bJYKLC2oD8SjyRdbs/hxHDziO2EWcmPt2S6fpekOSaVdtmynsIygMMoeVqVT4DEvPy7wHs1+Nzf7UmZaq3v1UChiZ7MwvW5Livhq+SAwL++RpHKXUjgLLwgajD+bSBaVEUCheSnInBSLS+z5e/9VOZoSvMP46tKdYiNlpc+WHDm44FPheWTXNHjtJLPHAwSCQfCr4Iyj48XOS8gkv6GEsGImWasgrsKU8LunDExfAO41OnSPEPfkQyS/wbvJ3K0yk6v71Ov2qeeTndpeqPOnUo8924PQbiIh1hEMYarYRibmedKUsU+VPPhezt+EhiCS90u2aLhPjB1GhXuZibCu5SHclwrvQtdiF0ZjPsM8EaFHHIhxOCOEmgu9OlfDuYrxw64UT2kAiiKfUUxiM7Rui2dAQsH8O/uGL4aaOrrnSLHI04PlK7APcybRIUQGSGssh0mUNJ47G1PKbponc0bZvVTSUUsYpIJwtgMzGR/J0Thg/FoD/7k5NG2mKurfzBp2aq0AlBE5d565pT9IBTAPcaY8Ch0tFkkr4Zzm/jaBov1C6gjNH8Kjf4HM8bM x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR11MB4031.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(136003)(376002)(396003)(366004)(39860400002)(451199021)(4326008)(54906003)(86362001)(66946007)(64756008)(66476007)(66556008)(55016003)(76116006)(66446008)(7696005)(8676002)(9686003)(41300700001)(33656002)(38100700002)(53546011)(6506007)(186003)(2906002)(8936002)(52536014)(478600001)(38070700005)(71200400001)(5660300002)(316002)(82960400001)(83380400001)(122000001)(110136005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Vf7bmqC7zeK85F6qQRXsS73t0KAuvbQxS+jhc/rTsYB1+lpWtouUP32hvl4K?= =?us-ascii?Q?S7mnZbG92J/UqzLc3FnPhu6HAqeMuDVd5+UD7No0ovIbR0ps3CaciKnxENUj?= =?us-ascii?Q?jBM+KNID+Un4nUcdzWfuY5W5nQaL5qqljigXjtqotYBs10x6YDbVm8kD4Oca?= =?us-ascii?Q?Ar34PVnCZYryfxn/VZrBRe26sXAxWXHlBjXSE8fHLMO9SJXfZmWVIzaPyEi1?= =?us-ascii?Q?cCXkh+LH/5ZniH3z40FtGRRmuwtvns72Abwv36GmcZBYNcBtLB7uh+EP4sQ7?= =?us-ascii?Q?45MZMFrRiDaBZSeadhC7kl0yyRC2KIgbMMLBHVwHQb4/L6bZPZTj2qoT3SR4?= =?us-ascii?Q?jDzZP69kf7nLaItk+heicADrMDtmZkFfj6MxTqx+6gKtdLlxdxu8pD0UZ/8a?= =?us-ascii?Q?f3QTomlPGyVRS9QVmPs0RMHS85UD152sMLgtUmvzILyK45hrz8+f0X5i3X0U?= =?us-ascii?Q?xXWSAAcvyLdGPYTw2hHsoycXVJ1sDossxGNAEXy5KvHOPtRKcb6dYl4udGAL?= =?us-ascii?Q?VWnJhBdmU/nlksAEf3kjCkR4Hmw7Fsn3laRTNNsa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83oPkZQHpHtEJuKFku4MkJTo/7lG9gYKz45fEJqzqFVzJJYA4?= =?us-ascii?Q?cHc6h/7dPQpRD1AWuPYXnatKxxm7+reK0W2vN2FmPmDvJcb2knGTuw62tA?= =?us-ascii?Q?=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR11MB4031.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fae3e22d-9b6d-4697-9db1-08db528941ed X-MS-Exchange-CrossTenant-originalarrivaltime: 12 May 2023 01:36:07.2762 (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: Av5O3ZyPsAs9PSuao4wK/zvtjC6EqYkQm6KGUIciNLmiTZD2jbeUA4rLhPqVYUjufBrpq/HyPdRRXLwMBIVD5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6137 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Hao A Wu Best Regards, Hao Wu > -----Original Message----- > From: Pedro Falcato > Sent: Wednesday, May 10, 2023 12:32 AM > To: devel@edk2.groups.io > Cc: Laszlo Ersek ; Pedro Falcato > ; Wang, Jian J ; Gao, > Liming ; Wu, Hao A ; Ni, > Ray ; Mike Maslenkin > Subject: [PATCH v2 04/12] MdeModulePkg/SataControllerDxe: Fix up ASSERTS > (Private !=3D NULL) >=20 > ASSERT (Private !=3D NULL) (where Private =3D CR(...)) is ineffective as > CR(Ptr, Type, Member, Sig) either returns Ptr - offsetof(Type, Member), > or ASSERTS on the signature, so it's unlikely to ever return NULL > (must be passed a pointer =3D member's offset, or in this case, 0x4). >=20 > ASSERT on This !=3D NULL instead. >=20 > Cc: Jian J Wang > Cc: Liming Gao > Cc: Hao A Wu > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Mike Maslenkin > Signed-off-by: Pedro Falcato > --- > MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > index f0ffd311d7b9..ea0116071c6a 100644 > --- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > +++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c > @@ -611,7 +611,6 @@ SataControllerStop ( > } >=20 > Private =3D SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (IdeInit); > - ASSERT (Private !=3D NULL); >=20 > // > // Uninstall the IDE Controller Init Protocol from this instance > @@ -745,8 +744,8 @@ IdeInitGetChannelInfo ( > { > EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; >=20 > + ASSERT (This !=3D NULL); > Private =3D SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); > - ASSERT (Private !=3D NULL); >=20 > if (Channel < This->ChannelCount) { > *Enabled =3D TRUE; > @@ -845,8 +844,8 @@ IdeInitSubmitData ( > EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; > UINTN DeviceIndex; >=20 > + ASSERT (This !=3D NULL); > Private =3D SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); > - ASSERT (Private !=3D NULL); >=20 > if ((Channel >=3D This->ChannelCount) || (Device >=3D Private->DeviceC= ount)) { > return EFI_INVALID_PARAMETER; > @@ -924,8 +923,8 @@ IdeInitDisqualifyMode ( > EFI_SATA_CONTROLLER_PRIVATE_DATA *Private; > UINTN DeviceIndex; >=20 > + ASSERT (This !=3D NULL); > Private =3D SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); > - ASSERT (Private !=3D NULL); >=20 > if ((Channel >=3D This->ChannelCount) || (BadModes =3D=3D NULL) || (De= vice >=3D > Private->DeviceCount)) { > return EFI_INVALID_PARAMETER; > @@ -1017,8 +1016,8 @@ IdeInitCalculateMode ( > EFI_STATUS Status; > UINTN DeviceIndex; >=20 > + ASSERT (This !=3D NULL); > Private =3D SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS (This); > - ASSERT (Private !=3D NULL); >=20 > if ((Channel >=3D This->ChannelCount) || (SupportedModes =3D=3D NULL) = || > (Device >=3D Private->DeviceCount)) { > return EFI_INVALID_PARAMETER; > -- > 2.40.1