From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E97F92194D3AE for ; Mon, 10 Dec 2018 22:44:24 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 22:44:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,341,1539673200"; d="scan'208";a="100545889" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 10 Dec 2018 22:44:24 -0800 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 22:44:24 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Dec 2018 22:44:23 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.203]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.210]) with mapi id 14.03.0415.000; Tue, 11 Dec 2018 14:44:20 +0800 From: "Gao, Liming" To: "Zhang, Shenglei" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" Thread-Topic: [PATCH 2/2] MdePkg/UefiDevicePathLib: Add a checking step Thread-Index: AQHUkRsW+7ReWZ3Kd0W2oXX5i8SxW6V5FtTg Date: Tue, 11 Dec 2018 06:44:19 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E389E1E@SHSMSX104.ccr.corp.intel.com> References: <20181211063041.25108-1-shenglei.zhang@intel.com> <20181211063041.25108-3-shenglei.zhang@intel.com> In-Reply-To: <20181211063041.25108-3-shenglei.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTY3MzA2ZWUtYWE1NS00NjFlLWE2MmItMWY4MjBiN2Y3NzNhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibE1CdzdDQXVRUGM4UlJicG5JdjM0TzBTcW9MMVIwdkMzXC95QzZhdXJ5Mkp0SStablZYOTVyVEhNRTIwT1JQaTcifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 2/2] MdePkg/UefiDevicePathLib: Add a checking step X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 06:44:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Shenglei: Please update IsDevicePathValid() API description in MdePkg\Include\Libra= ry\DevicePathLib.h, and also remove ASSERT (DevicePath !=3D NULL); in funct= ion implementation. Thanks Liming > -----Original Message----- > From: Zhang, Shenglei > Sent: Tuesday, December 11, 2018 2:31 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming ; Kinney, Michael D > Subject: [PATCH 2/2] MdePkg/UefiDevicePathLib: Add a checking step >=20 > Add a checking step in DevicePathUtilities.c to verify DevicePath. >=20 > Cc: Liming Gao > Cc: Michael D Kinney > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Shenglei Zhang > --- > .../Library/UefiDevicePathLib/DevicePathUtilities.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/Mde= Pkg/Library/UefiDevicePathLib/DevicePathUtilities.c > index 665e5a4adc..f29e1e22f6 100644 > --- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c > +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c > @@ -59,6 +59,18 @@ IsDevicePathValid ( > UINTN Size; > UINTN NodeLength; >=20 > +/** > + NULL device path is also invalid path. > + > + IsDevicePathValid() should return FALSE or TRUE, and not ASSERT(). > + > + This change needs to update IsDevicePathValid() API definition and imp= lementation both. > + > +**/ > + if (DevicePath =3D=3D NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PAT= H_LENGTH)) { > + return FALSE; > + } > + > ASSERT (DevicePath !=3D NULL); >=20 > if (MaxSize =3D=3D 0) { > -- > 2.18.0.windows.1