From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.1122.1572418867203503908 for ; Wed, 30 Oct 2019 00:01:07 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2019 00:01:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,246,1569308400"; d="scan'208";a="225227521" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 30 Oct 2019 00:01:06 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 30 Oct 2019 00:01:06 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 30 Oct 2019 00:01:06 -0700 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; Wed, 30 Oct 2019 15:01:04 +0800 From: "Wu, Hao A" To: "Zhang, Shenglei" , "devel@edk2.groups.io" , "Dong, Eric" , "Bi, Dandan" CC: "Wang, Jian J" Subject: Re: [PATCH 4/4] MdeModulePkg/SetupBrowserDxe: Add check for GetBufferForValue() Thread-Topic: [PATCH 4/4] MdeModulePkg/SetupBrowserDxe: Add check for GetBufferForValue() Thread-Index: AQHVhJtaSGUWcnUamEa0tBwSrfHa/qdy1CVQ Date: Wed, 30 Oct 2019 07:01:03 +0000 Message-ID: References: <20191017033110.12128-1-shenglei.zhang@intel.com> <20191017033110.12128-5-shenglei.zhang@intel.com> In-Reply-To: <20191017033110.12128-5-shenglei.zhang@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello Eric and Dandan, Could you help to review this patch? Thanks in advance. Best Regards, Hao Wu > -----Original Message----- > From: Zhang, Shenglei > Sent: Thursday, October 17, 2019 11:31 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J; Wu, Hao A > Subject: [PATCH 4/4] MdeModulePkg/SetupBrowserDxe: Add check for > GetBufferForValue() >=20 > The returned value from GetBufferForValue might be NULL, so add a > check for that before it is used. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Shenglei Zhang > --- > MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > index 7f4929c2fcd9..984c68c6bb7a 100644 > --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c > @@ -1281,7 +1281,12 @@ IfrToUint ( > Result->Type =3D EFI_IFR_TYPE_UNDEFINED; > return EFI_SUCCESS; > } > + > + if (GetBufferForValue (&Value) =3D=3D NULL) { > + return EFI_NOT_FOUND; > + } > Result->Value.u64 =3D *(UINT64*) GetBufferForValue (&Value); > + > if (Value.Type =3D=3D EFI_IFR_TYPE_BUFFER) { > FreePool (Value.Buffer); > } > -- > 2.18.0.windows.1