From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.5.60; helo=eur03-ve1-obe.outbound.protection.outlook.com; envelope-from=udit.kumar@nxp.com; receiver=edk2-devel@lists.01.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50060.outbound.protection.outlook.com [40.107.5.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0859221F2AF74 for ; Thu, 28 Sep 2017 02:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=anrO6UjxyW6wXxjaPVvDkztMtanpqoUrAUmNXUOKRuI=; b=ZL+v+SbB3jfrS0tONq//isoOYc9GfYqlT88mgFitB9rdqwIl0NDnTEV7y2vH43QqcdS1UGtfzpXWf7Q1MW6VX1OnmH8PHHC2Z+x5N4eEX3QbofzAArjNRNtxjb7kfD3TyjLeP7GzDuJsqF2SzTRfS1RYysFweeyE1JxFcP2PA94= Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com (52.133.18.151) by AM6PR0402MB3335.eurprd04.prod.outlook.com (52.133.18.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 28 Sep 2017 09:27:30 +0000 Received: from AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::4d05:6a0c:bcca:93be]) by AM6PR0402MB3334.eurprd04.prod.outlook.com ([fe80::4d05:6a0c:bcca:93be%13]) with mapi id 15.20.0077.016; Thu, 28 Sep 2017 09:27:30 +0000 From: Udit Kumar To: Hao Wu , "edk2-devel@lists.01.org" CC: Michael D Kinney , Jiewen Yao , Star Zeng Thread-Topic: [edk2] [PATCH] MdeModulePkg/DxeCore: Add comments for the ASSERT to check NULL ptr Thread-Index: AQHTOCeGaoNvHWhvd0yT2lQRSGW7dKLKBhgw Date: Thu, 28 Sep 2017 09:27:30 +0000 Message-ID: References: <20170928070039.632-1-hao.a.wu@intel.com> In-Reply-To: <20170928070039.632-1-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=udit.kumar@nxp.com; x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0402MB3335; 6:jY+Vb1Cwu1kdhE3ehxOHqclhkwK+iTPZHRyt6+fOcr9S7yQ7st4hRPd28CTZ8mQ2CfpoAZHnAbjgrSymL74prwEGtSBFRGJ6sgBerwLaZhI0S4V645C+XXIRs1zS3/PjX6SY6DZmH5Wb2Gp+OGJ1gCUI/ujri2jSf0+J0dUvVR/nP0oMtjBaunzP0JQ+1dZZ96spce1TAZT/8rplSJaqFkCQN8sDkPKW+r60QNR8cSSxDvQHyES+oQ5pLiAlhw1JVn4S8HG0vyN7D09oKoeE/uX7UZkCfPb8+iu7WceMvPgrE0AQs0E+Xb46Ip014WGmpTKueBXo3xSxynzqCQRDtw==; 5:pmwU0fyq0KnEHuyOKTq3GqrNnO6TH8Br2+GBxuAGoA2itgZ4A4WucinRfI5T8jyaJl9evBgY3tyfx2cpNRU4DFP9r7jEvVW98L0ayyrKRn2RVvL9RAkQwBWybNr3nZ4lTorDroScie0kJLY1u9e8Og==; 24:7vMjUdATJSOi7GiouOKcV1jBg4kXfj8yUiSAEE/OHrddO0SGq4OyWnqRLqXKKH+DRMXC6fvNQ4ddVOEWnG+qyAe5qhZdbDYs/CtfHpmDR5k=; 7:Kbuu80JdQgDUXcNcB5tqMyfqzucNoW0qM8hsN22lpk2oXcYlK4LcmZA/aJMWWxEve22RcLZPe4s10/qaJVlOaU4t4qbsV8Ibill7Yfw7FZrKIY3BPYhRtVxoOzbSySupRWxa1Xa1Wz5g7RI/X5iWAIrPx7JknlwtnTkr/ZL+Ti5LYiYTxZgiEx74nn3NCHRrzTt2TflL/vYgH9VUulPEzW2vfTr0p1gUUxiw07KudVM= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 78a6c475-011c-4e4a-a2b9-08d50653248f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:AM6PR0402MB3335; x-ms-traffictypediagnostic: AM6PR0402MB3335: x-exchange-antispam-report-test: UriScan:(162533806227266)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM6PR0402MB3335; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM6PR0402MB3335; x-forefront-prvs: 0444EB1997 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(376002)(346002)(189002)(377454003)(199003)(43544003)(13464003)(14454004)(8936002)(316002)(97736004)(53936002)(3660700001)(2501003)(54356999)(76176999)(50986999)(5250100002)(74316002)(5660300001)(2900100001)(2950100002)(7736002)(105586002)(54906003)(8676002)(305945005)(106356001)(189998001)(2906002)(110136005)(81156014)(81166006)(101416001)(55016002)(6306002)(25786009)(68736007)(3280700002)(86362001)(6116002)(3846002)(99286003)(66066001)(9686003)(4326008)(102836003)(966005)(6436002)(7696004)(6506006)(478600001)(33656002)(6246003)(53546010)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0402MB3335; H:AM6PR0402MB3334.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2017 09:27:30.7301 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3335 Subject: Re: [PATCH] MdeModulePkg/DxeCore: Add comments for the ASSERT to check NULL ptr X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 09:24:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ha= o > Wu > Sent: Thursday, September 28, 2017 12:31 PM > To: edk2-devel@lists.01.org > Cc: Hao Wu ; Michael D Kinney > ; Jiewen Yao ; Star Zen= g > > Subject: [edk2] [PATCH] MdeModulePkg/DxeCore: Add comments for the > ASSERT to check NULL ptr >=20 > Commit 8932679df5be046feba30fae80776c5815232a08 adds an ASSERT for > checking NULL pointer dereference. >=20 > This commit adds comments to clarify the reason for using ASSERT as the c= heck. >=20 > Cc: Star Zeng > Cc: Michael D Kinney > Cc: Jiewen Yao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > MdeModulePkg/Core/Dxe/Hand/Handle.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c > b/MdeModulePkg/Core/Dxe/Hand/Handle.c > index 2db441725c..344ff1fe02 100644 > --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c > +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c > @@ -1175,10 +1175,15 @@ Done: > // > if (!EFI_ERROR (Status) || Status =3D=3D EFI_ALREADY_STARTED) { > // > + // According to above logic, if 'Prot' is NULL, then the 'Status' = must be > + // EFI_UNSUPPORTED. Here the 'Status' is not EFI_UNSUPPORTED, so '= Prot' > + // must be not NULL. > + // > + ASSERT (Prot !=3D NULL); > + // I think , we should take care of no debug environment here=20 If MDEPKG_NDEBUG is not defined and Prot is NULL then=20 shouldn't we return error ? > // EFI_ALREADY_STARTED is not an error for bus driver. > // Return the corresponding protocol interface. > // > - ASSERT (Prot !=3D NULL); > *Interface =3D Prot->Interface; > } else if (Status =3D=3D EFI_UNSUPPORTED) { > // > -- > 2.12.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel