From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.15978.1572920668710405772 for ; Mon, 04 Nov 2019 18:24:28 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: dandan.bi@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2019 18:24:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,269,1569308400"; d="scan'208";a="232298093" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 04 Nov 2019 18:24:28 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 4 Nov 2019 18:24:28 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 4 Nov 2019 18:24:27 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.127]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.200]) with mapi id 14.03.0439.000; Tue, 5 Nov 2019 10:24:25 +0800 From: "Dandan Bi" To: "devel@edk2.groups.io" , "Zhang, Shenglei" CC: "Wang, Jian J" , "Wu, Hao A" Subject: Re: [edk2-devel] [PATCH v3 4/4] MdeModulePkg/SetupBrowserDxe: ASSERT GetBufferForValue(&Value) Thread-Topic: [edk2-devel] [PATCH v3 4/4] MdeModulePkg/SetupBrowserDxe: ASSERT GetBufferForValue(&Value) Thread-Index: AQHVkHuqpcAZu/PpPE+WpWLTKpjIr6d73zSg Date: Tue, 5 Nov 2019 02:24:25 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB40C95CAC@SHSMSX104.ccr.corp.intel.com> References: <20191101061417.28896-1-shenglei.zhang@intel.com> <20191101061417.28896-5-shenglei.zhang@intel.com> In-Reply-To: <20191101061417.28896-5-shenglei.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: dandan.bi@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Dandan Bi Thanks, Dandan > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Zhang, Shenglei > Sent: Friday, November 1, 2019 2:14 PM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A > Subject: [edk2-devel] [PATCH v3 4/4] MdeModulePkg/SetupBrowserDxe: > ASSERT GetBufferForValue(&Value) >=20 > Before called by GetBufferForValue(), Value has already been called func= tion > IsTypeInBuffer to make sure the value must be buffer type. > So GetBufferForValue can not return NULL. > This commit adds ASSERT to assume (GetBufferForValue (&Value) is not > NULL. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Shenglei Zhang > --- >=20 > v3: Add ASSERT instead of using error handling. >=20 > MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > index 7f4929c2fcd9..138912e00823 100644 > --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > @@ -1281,7 +1281,10 @@ IfrToUint ( > Result->Type =3D EFI_IFR_TYPE_UNDEFINED; > return EFI_SUCCESS; > } > + > + ASSERT ((GetBufferForValue (&Value) !=3D NULL); > Result->Value.u64 =3D *(UINT64*) GetBufferForValue (&Value); > + > if (Value.Type =3D=3D EFI_IFR_TYPE_BUFFER) { > FreePool (Value.Buffer); > } > -- > 2.18.0.windows.1 >=20 >=20 >=20