* [PATCH 0/2] Add a checking step in MdePkg and Basetools
@ 2018-12-11 6:30 Shenglei Zhang
2018-12-11 6:30 ` [PATCH 1/2] BaseTools/DevicePath: Add a checking step Shenglei Zhang
2018-12-11 6:30 ` [PATCH 2/2] MdePkg/UefiDevicePathLib: " Shenglei Zhang
0 siblings, 2 replies; 4+ messages in thread
From: Shenglei Zhang @ 2018-12-11 6:30 UTC (permalink / raw)
To: edk2-devel; +Cc: Bob Feng, Liming Gao, Michael D Kinney
Add a checking step to verify DevicePath.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Shenglei Zhang (2):
BaseTools/DevicePath: Add a checking step
MdePkg/UefiDevicePathLib: Add a checking step
BaseTools/Source/C/DevicePath/DevicePathUtilities.c | 12 ++++++++++++
.../Library/UefiDevicePathLib/DevicePathUtilities.c | 12 ++++++++++++
2 files changed, 24 insertions(+)
--
2.18.0.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] BaseTools/DevicePath: Add a checking step
2018-12-11 6:30 [PATCH 0/2] Add a checking step in MdePkg and Basetools Shenglei Zhang
@ 2018-12-11 6:30 ` Shenglei Zhang
2018-12-11 6:30 ` [PATCH 2/2] MdePkg/UefiDevicePathLib: " Shenglei Zhang
1 sibling, 0 replies; 4+ messages in thread
From: Shenglei Zhang @ 2018-12-11 6:30 UTC (permalink / raw)
To: edk2-devel; +Cc: Bob Feng, Liming Gao
Add a checking step in DevicePathUtilities.c to verify DevicePath.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
BaseTools/Source/C/DevicePath/DevicePathUtilities.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
index f8a41ff97d..e2efaeebf0 100644
--- a/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
+++ b/BaseTools/Source/C/DevicePath/DevicePathUtilities.c
@@ -59,6 +59,18 @@ IsDevicePathValid (
UINTN Size;
UINTN NodeLength;
+/**
+ 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 implementation both.
+
+**/
+ if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
+ return FALSE;
+ }
+
ASSERT (DevicePath != NULL);
if (MaxSize == 0) {
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] MdePkg/UefiDevicePathLib: Add a checking step
2018-12-11 6:30 [PATCH 0/2] Add a checking step in MdePkg and Basetools Shenglei Zhang
2018-12-11 6:30 ` [PATCH 1/2] BaseTools/DevicePath: Add a checking step Shenglei Zhang
@ 2018-12-11 6:30 ` Shenglei Zhang
2018-12-11 6:44 ` Gao, Liming
1 sibling, 1 reply; 4+ messages in thread
From: Shenglei Zhang @ 2018-12-11 6:30 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Michael D Kinney
Add a checking step in DevicePathUtilities.c to verify DevicePath.
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>
---
.../Library/UefiDevicePathLib/DevicePathUtilities.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdePkg/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;
+/**
+ 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 implementation both.
+
+**/
+ if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
+ return FALSE;
+ }
+
ASSERT (DevicePath != NULL);
if (MaxSize == 0) {
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] MdePkg/UefiDevicePathLib: Add a checking step
2018-12-11 6:30 ` [PATCH 2/2] MdePkg/UefiDevicePathLib: " Shenglei Zhang
@ 2018-12-11 6:44 ` Gao, Liming
0 siblings, 0 replies; 4+ messages in thread
From: Gao, Liming @ 2018-12-11 6:44 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org; +Cc: Kinney, Michael D
Shenglei:
Please update IsDevicePathValid() API description in MdePkg\Include\Library\DevicePathLib.h, and also remove ASSERT (DevicePath != NULL); in function 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 <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
> Subject: [PATCH 2/2] MdePkg/UefiDevicePathLib: Add a checking step
>
> Add a checking step in DevicePathUtilities.c to verify DevicePath.
>
> 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>
> ---
> .../Library/UefiDevicePathLib/DevicePathUtilities.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdePkg/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;
>
> +/**
> + 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 implementation both.
> +
> +**/
> + if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
> + return FALSE;
> + }
> +
> ASSERT (DevicePath != NULL);
>
> if (MaxSize == 0) {
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-11 6:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-11 6:30 [PATCH 0/2] Add a checking step in MdePkg and Basetools Shenglei Zhang
2018-12-11 6:30 ` [PATCH 1/2] BaseTools/DevicePath: Add a checking step Shenglei Zhang
2018-12-11 6:30 ` [PATCH 2/2] MdePkg/UefiDevicePathLib: " Shenglei Zhang
2018-12-11 6:44 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox