public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Improve performance of boundary validation in MakeTable()
@ 2019-03-21  6:31 shenglei
  2019-03-21  6:31 ` [PATCH v2 1/3] BaseTools/TianoCompress: Improve performance of boundary validation shenglei
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: shenglei @ 2019-03-21  6:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Bob Feng, Liming Gao, Yonghong Zhu, Michael D Kinney

The boundary validation checking in MakeTable() performs on
every loop iteration. This could be improved by checking
just once before the loop.
https://bugzilla.tianocore.org/show_bug.cgi?id=1329

v2:1.Change the the algorithm implementation of the judgement in all patches.
   2.Remove previous 3/4 in v1.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Shenglei Zhang (3):
  BaseTools/TianoCompress: Improve performance of boundary validation
  BaseTools/C/Common: Improve performance of boundary validation
  MdePkg/BaseUefiDecompressLib: Improve performance of boundary
    validation

 BaseTools/Source/C/Common/Decompress.c                     | 7 ++++---
 BaseTools/Source/C/TianoCompress/TianoCompress.c           | 7 ++++---
 .../Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c  | 7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)

-- 
2.18.0.windows.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] BaseTools/TianoCompress: Improve performance of boundary validation
  2019-03-21  6:31 [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() shenglei
@ 2019-03-21  6:31 ` shenglei
  2019-03-21  6:31 ` [PATCH v2 2/3] BaseTools/C/Common: " shenglei
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: shenglei @ 2019-03-21  6:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Shenglei Zhang, Bob Feng, Liming Gao, Yonghong Zhu

From: Shenglei Zhang <shenglei.zhang@intel.com>

The boundary validation checking in MakeTable() performs on
every loop iteration. This could be improved by checking
just once before the loop.
https://bugzilla.tianocore.org/show_bug.cgi?id=1329

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
 BaseTools/Source/C/TianoCompress/TianoCompress.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index 29b11c597f..ae88074360 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -2281,10 +2281,11 @@ Returns:
 
     if (Len <= TableBits) {
 
+      if (Start[Len] >= NextCode || NextCode > MaxTableLength){
+        return (UINT16) BAD_TABLE;
+      }
+
       for (Index = Start[Len]; Index < NextCode; Index++) {
-        if (Index >= MaxTableLength) {
-          return (UINT16) BAD_TABLE;
-        }
         Table[Index] = Char;
       }
 
-- 
2.18.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] BaseTools/C/Common: Improve performance of boundary validation
  2019-03-21  6:31 [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() shenglei
  2019-03-21  6:31 ` [PATCH v2 1/3] BaseTools/TianoCompress: Improve performance of boundary validation shenglei
@ 2019-03-21  6:31 ` shenglei
  2019-03-21  6:31 ` [PATCH v2 3/3] MdePkg/BaseUefiDecompressLib: " shenglei
  2019-03-22  6:34 ` [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() Gao, Liming
  3 siblings, 0 replies; 5+ messages in thread
From: shenglei @ 2019-03-21  6:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Shenglei Zhang, Bob Feng, Liming Gao, Yonghong Zhu

From: Shenglei Zhang <shenglei.zhang@intel.com>

The boundary validation checking in MakeTable() performs on
every loop iteration. This could be improved by checking
just once before the loop.
https://bugzilla.tianocore.org/show_bug.cgi?id=1329

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
 BaseTools/Source/C/Common/Decompress.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
index 0e9ba0a982..e9ac1d58b3 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -254,10 +254,11 @@ Returns:
 
     if (Len <= TableBits) {
 
+      if (Start[Len] >= NextCode || NextCode > MaxTableLength){
+        return (UINT16) BAD_TABLE;
+      }
+
       for (Index = Start[Len]; Index < NextCode; Index++) {
-        if (Index >= MaxTableLength) {
-          return (UINT16) BAD_TABLE;
-        }
         Table[Index] = Char;
       }
 
-- 
2.18.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] MdePkg/BaseUefiDecompressLib: Improve performance of boundary validation
  2019-03-21  6:31 [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() shenglei
  2019-03-21  6:31 ` [PATCH v2 1/3] BaseTools/TianoCompress: Improve performance of boundary validation shenglei
  2019-03-21  6:31 ` [PATCH v2 2/3] BaseTools/C/Common: " shenglei
@ 2019-03-21  6:31 ` shenglei
  2019-03-22  6:34 ` [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() Gao, Liming
  3 siblings, 0 replies; 5+ messages in thread
From: shenglei @ 2019-03-21  6:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Shenglei Zhang, Michael D Kinney, Liming Gao

From: Shenglei Zhang <shenglei.zhang@intel.com>

The boundary validation checking in MakeTable() performs on
every loop iteration. This could be improved by checking
just once before the loop.
https://bugzilla.tianocore.org/show_bug.cgi?id=1329

Cc: Michael D Kinney <michael.d.kinney@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>
---
 .../Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
index c1e8c5581a..3d5b7a737a 100644
--- a/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
+++ b/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
@@ -222,10 +222,11 @@ MakeTable (
 
     if (Len <= TableBits) {
 
+      if (Start[Len] >= NextCode || NextCode > MaxTableLength){
+        return (UINT16) BAD_TABLE;
+      }
+
       for (Index = Start[Len]; Index < NextCode; Index++) {
-        if (Index >= MaxTableLength) {
-          return (UINT16) BAD_TABLE;
-        }
         Table[Index] = Char;
       }
 
-- 
2.18.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/3] Improve performance of boundary validation in MakeTable()
  2019-03-21  6:31 [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() shenglei
                   ` (2 preceding siblings ...)
  2019-03-21  6:31 ` [PATCH v2 3/3] MdePkg/BaseUefiDecompressLib: " shenglei
@ 2019-03-22  6:34 ` Gao, Liming
  3 siblings, 0 replies; 5+ messages in thread
From: Gao, Liming @ 2019-03-22  6:34 UTC (permalink / raw)
  To: Zhang, Shenglei, edk2-devel@lists.01.org; +Cc: Kinney, Michael D

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>shenglei
>Sent: Thursday, March 21, 2019 2:32 PM
>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 0/3] Improve performance of boundary validation
>in MakeTable()
>
>The boundary validation checking in MakeTable() performs on
>every loop iteration. This could be improved by checking
>just once before the loop.
>https://bugzilla.tianocore.org/show_bug.cgi?id=1329
>
>v2:1.Change the the algorithm implementation of the judgement in all
>patches.
>   2.Remove previous 3/4 in v1.
>
>Cc: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Yonghong Zhu <yonghong.zhu@intel.com>
>Cc: Michael D Kinney <michael.d.kinney@intel.com>
>Shenglei Zhang (3):
>  BaseTools/TianoCompress: Improve performance of boundary validation
>  BaseTools/C/Common: Improve performance of boundary validation
>  MdePkg/BaseUefiDecompressLib: Improve performance of boundary
>    validation
>
> BaseTools/Source/C/Common/Decompress.c                     | 7 ++++---
> BaseTools/Source/C/TianoCompress/TianoCompress.c           | 7 ++++---
> .../Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c  | 7 ++++---
> 3 files changed, 12 insertions(+), 9 deletions(-)
>
>--
>2.18.0.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-22  6:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-21  6:31 [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() shenglei
2019-03-21  6:31 ` [PATCH v2 1/3] BaseTools/TianoCompress: Improve performance of boundary validation shenglei
2019-03-21  6:31 ` [PATCH v2 2/3] BaseTools/C/Common: " shenglei
2019-03-21  6:31 ` [PATCH v2 3/3] MdePkg/BaseUefiDecompressLib: " shenglei
2019-03-22  6:34 ` [PATCH v2 0/3] Improve performance of boundary validation in MakeTable() Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox