public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer
@ 2020-04-14  1:32 Guomin Jiang
  2020-05-14 23:22 ` Michael D Kinney
  0 siblings, 1 reply; 2+ messages in thread
From: Guomin Jiang @ 2020-04-14  1:32 UTC (permalink / raw)
  To: devel; +Cc: kuqin, Michael D Kinney, Sean Brogan, Bret Barkelew

From: kuqin <kuqin@microsoft.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2609

SavedState is not sticky, copied pointer update will not change source
pointer

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
---
 UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
index b136992d99..ba4b18568d 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
@@ -209,7 +209,6 @@ InitUnitTestFramework (
   EFI_STATUS                  Status;
   UNIT_TEST_FRAMEWORK_HANDLE  NewFrameworkHandle;
   UNIT_TEST_FRAMEWORK         *NewFramework;
-  UNIT_TEST_SAVE_HEADER       *SavedState;
 
   Status       = EFI_SUCCESS;
   NewFramework = NULL;
@@ -264,8 +263,7 @@ InitUnitTestFramework (
   // If there is a persisted context, load it now.
   //
   if (DoesCacheExist (NewFrameworkHandle)) {
-    SavedState = (UNIT_TEST_SAVE_HEADER *)NewFramework->SavedState;
-    Status = LoadUnitTestCache (NewFrameworkHandle, &SavedState);
+    Status = LoadUnitTestCache (NewFrameworkHandle,  (UNIT_TEST_SAVE_HEADER**)(&NewFramework->SavedState));
     if (EFI_ERROR (Status)) {
       //
       // Don't actually report it as an error, but emit a warning.
-- 
2.25.1.windows.1


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

* Re: [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer
  2020-04-14  1:32 [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer Guomin Jiang
@ 2020-05-14 23:22 ` Michael D Kinney
  0 siblings, 0 replies; 2+ messages in thread
From: Michael D Kinney @ 2020-05-14 23:22 UTC (permalink / raw)
  To: Jiang, Guomin, devel@edk2.groups.io, Kinney, Michael D
  Cc: kuqin, Sean Brogan, Bret Barkelew

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

Mike

> -----Original Message-----
> From: Jiang, Guomin <guomin.jiang@intel.com>
> Sent: Monday, April 13, 2020 6:33 PM
> To: devel@edk2.groups.io
> Cc: kuqin <kuqin@microsoft.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Sean Brogan
> <sean.brogan@microsoft.com>; Bret Barkelew
> <Bret.Barkelew@microsoft.com>
> Subject: [PATCH v2] UnitTestFrameworkPkg/UnitTestLib:
> Correct dereferred pointer
> 
> From: kuqin <kuqin@microsoft.com>
> 
> REF:
> https://bugzilla.tianocore.org/show_bug.cgi?id=2609
> 
> SavedState is not sticky, copied pointer update will
> not change source
> pointer
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
> ---
>  UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
> | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git
> a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.
> c
> b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.
> c
> index b136992d99..ba4b18568d 100644
> ---
> a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.
> c
> +++
> b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.
> c
> @@ -209,7 +209,6 @@ InitUnitTestFramework (
>    EFI_STATUS                  Status;
> 
>    UNIT_TEST_FRAMEWORK_HANDLE  NewFrameworkHandle;
> 
>    UNIT_TEST_FRAMEWORK         *NewFramework;
> 
> -  UNIT_TEST_SAVE_HEADER       *SavedState;
> 
> 
> 
>    Status       = EFI_SUCCESS;
> 
>    NewFramework = NULL;
> 
> @@ -264,8 +263,7 @@ InitUnitTestFramework (
>    // If there is a persisted context, load it now.
> 
>    //
> 
>    if (DoesCacheExist (NewFrameworkHandle)) {
> 
> -    SavedState = (UNIT_TEST_SAVE_HEADER
> *)NewFramework->SavedState;
> 
> -    Status = LoadUnitTestCache (NewFrameworkHandle,
> &SavedState);
> 
> +    Status = LoadUnitTestCache (NewFrameworkHandle,
> (UNIT_TEST_SAVE_HEADER**)(&NewFramework->SavedState));
> 
>      if (EFI_ERROR (Status)) {
> 
>        //
> 
>        // Don't actually report it as an error, but
> emit a warning.
> 
> --
> 2.25.1.windows.1


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

end of thread, other threads:[~2020-05-14 23:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-14  1:32 [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer Guomin Jiang
2020-05-14 23:22 ` Michael D Kinney

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