From: "Gao, Liming" <liming.gao@intel.com>
To: "Zhang, Shenglei" <shenglei.zhang@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
"Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH v2 2/2] MdePkg/UefiDevicePathLib: Add a checking step
Date: Tue, 29 Jan 2019 01:29:20 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3D190B@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20181212031011.20996-3-shenglei.zhang@intel.com>
Shenglei:
The patch is good. Reviewed-by: Liming Gao <liming.gao@intel.com>
Besides, this patch is from MS Mu project. Please keep original patch author. You don't need to send this patch again.
Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Shenglei Zhang
> Sent: Wednesday, December 12, 2018 11:10 AM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [PATCH v2 2/2] MdePkg/UefiDevicePathLib: Add a checking step
>
> Add a checking step in DevicePathUtilities.c to verify the DevicePath.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1372
>
> v2: Remove ASSERT() and the redundant checking step.
> Update related description in DevicePathLib.h
>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> MdePkg/Include/Library/DevicePathLib.h | 2 +-
> .../UefiDevicePathLib/DevicePathUtilities.c | 14 ++++++--------
> 2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/MdePkg/Include/Library/DevicePathLib.h b/MdePkg/Include/Library/DevicePathLib.h
> index 959299704a..717d4db42f 100644
> --- a/MdePkg/Include/Library/DevicePathLib.h
> +++ b/MdePkg/Include/Library/DevicePathLib.h
> @@ -22,7 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
> /**
> Determine whether a given device path is valid.
> - If DevicePath is NULL, then ASSERT().
> + If DevicePath is NULL or the size is not suitable, then return false.
>
> @param DevicePath A pointer to a device path data structure.
> @param MaxSize The maximum size of the device path data structure.
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
> index 665e5a4adc..05f82c1313 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
> @@ -59,19 +59,17 @@ IsDevicePathValid (
> UINTN Size;
> UINTN NodeLength;
>
> - ASSERT (DevicePath != NULL);
> -
> - if (MaxSize == 0) {
> - MaxSize = MAX_UINTN;
> - }
> -
> //
> - // Validate the input size big enough to touch the first node.
> + //Validate the input whether exists and its size big enough to touch the first node
> //
> - if (MaxSize < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
> + if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
> return FALSE;
> }
>
> + if (MaxSize == 0) {
> + MaxSize = MAX_UINTN;
> + }
> +
> for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
> NodeLength = DevicePathNodeLength (DevicePath);
> if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
> --
> 2.18.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2019-01-29 1:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 3:10 [PATCH v2 0/2] Add a checking step in MdePkg and Basetools Shenglei Zhang
2018-12-12 3:10 ` [PATCH v2 2/2] BaseTools/DevicePath: Add a checking step Shenglei Zhang
2019-01-29 3:08 ` Gao, Liming
2018-12-12 3:10 ` [PATCH v2 2/2] MdePkg/UefiDevicePathLib: " Shenglei Zhang
2019-01-29 1:29 ` Gao, Liming [this message]
2019-01-29 3:41 ` Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E3D190B@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox