public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.
       [not found] <160150CCACE2328E.16021@groups.io>
@ 2020-04-08  5:29 ` Guomin Jiang
  2020-04-08  5:59   ` Sean
  0 siblings, 1 reply; 6+ messages in thread
From: Guomin Jiang @ 2020-04-08  5:29 UTC (permalink / raw)
  To: devel@edk2.groups.io, Jiang, Guomin
  Cc: Kinney, Michael D, Sean Brogan, Bret Barkelew

Hi Kinney, Sean, Bret,

Could you help review the change.

Best Regards
guomin

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Guomin
> Jiang
> Sent: Tuesday, March 31, 2020 2:50 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan
> <sean.brogan@microsoft.com>; Bret Barkelew
> <Bret.Barkelew@microsoft.com>
> Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct
> dereferred pointer.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2609
> 
> The copied pointer (SavedState) will be updated by LoadUnitTestCache
> call. But the change of SavedState will not update source pointer, which
> is NewFramework->SavedState in this case.
> 
> 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 | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
> b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
> index b136992d99..71050b5618 100644
> --- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
> +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
> @@ -209,7 +209,7 @@ InitUnitTestFramework (
>    EFI_STATUS                  Status;
> 
>    UNIT_TEST_FRAMEWORK_HANDLE  NewFrameworkHandle;
> 
>    UNIT_TEST_FRAMEWORK         *NewFramework;
> 
> -  UNIT_TEST_SAVE_HEADER       *SavedState;
> 
> +  UNIT_TEST_SAVE_HEADER       **SavedState;
> 
> 
> 
>    Status       = EFI_SUCCESS;
> 
>    NewFramework = NULL;
> 
> @@ -264,8 +264,8 @@ InitUnitTestFramework (
>    // If there is a persisted context, load it now.
> 
>    //
> 
>    if (DoesCacheExist (NewFrameworkHandle)) {
> 
> -    SavedState = (UNIT_TEST_SAVE_HEADER *)NewFramework->SavedState;
> 
> -    Status = LoadUnitTestCache (NewFrameworkHandle, &SavedState);
> 
> +    SavedState = (UNIT_TEST_SAVE_HEADER **)(&NewFramework-
> >SavedState);
> 
> +    Status = LoadUnitTestCache (NewFrameworkHandle, SavedState);
> 
>      if (EFI_ERROR (Status)) {
> 
>        //
> 
>        // Don't actually report it as an error, but emit a warning.
> 
> --
> 2.25.1.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#56724): https://edk2.groups.io/g/devel/message/56724
> Mute This Topic: https://groups.io/mt/72671870/4399222
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [guomin.jiang@intel.com]
> -=-=-=-=-=-=


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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.
  2020-04-08  5:29 ` [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer Guomin Jiang
@ 2020-04-08  5:59   ` Sean
  2020-04-09  1:29     ` Guomin Jiang
  0 siblings, 1 reply; 6+ messages in thread
From: Sean @ 2020-04-08  5:59 UTC (permalink / raw)
  To: Guomin Jiang, devel

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

Guomin,

Can you speak to why you implemented differently than the suggested and validated patch?  Seems you created a local whereas ours just used the internal data member.

Thanks
sean

[-- Attachment #2: Type: text/html, Size: 230 bytes --]

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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.
  2020-04-08  5:59   ` Sean
@ 2020-04-09  1:29     ` Guomin Jiang
  2020-04-10  7:17       ` Kun Qin
  0 siblings, 1 reply; 6+ messages in thread
From: Guomin Jiang @ 2020-04-09  1:29 UTC (permalink / raw)
  To: Sean, devel@edk2.groups.io; +Cc: Kun Qin

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

Hi Sean,

I think it meet the original code logic more closely.

According to the LoadUnitTestCache(), it need pointer to pointer, the defect is resulted by pointer to local pointer and I think the original logical just want use the local variable as pointer to pointer.

I have reviewed the suggested change and think both are the same logic.

Hi Qin,

Can you give some comment?

Best Regards
guomin
From: sean.brogan via [] <sean.brogan=microsoft.com@[]>
Sent: Wednesday, April 8, 2020 2:00 PM
To: Jiang, Guomin <guomin.jiang@intel.com>; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Guomin,

Can you speak to why you implemented differently than the suggested and validated patch?  Seems you created a local whereas ours just used the internal data member.

Thanks
sean

[-- Attachment #2: Type: text/html, Size: 3794 bytes --]

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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.
  2020-04-09  1:29     ` Guomin Jiang
@ 2020-04-10  7:17       ` Kun Qin
  2020-04-13  6:20         ` Guomin Jiang
  0 siblings, 1 reply; 6+ messages in thread
From: Kun Qin @ 2020-04-10  7:17 UTC (permalink / raw)
  To: Jiang, Guomin, Sean Brogan, devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]

Hi Guomin,

Could you please point me to the proposed change?

Thanks,
Kun

From: Jiang, Guomin <guomin.jiang@intel.com>
Sent: Wednesday, April 8, 2020 6:30 PM
To: Sean Brogan <sean.brogan@microsoft.com>; devel@edk2.groups.io
Cc: Kun Qin <Kun.Qin@microsoft.com>
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Hi Sean,

I think it meet the original code logic more closely.

According to the LoadUnitTestCache(), it need pointer to pointer, the defect is resulted by pointer to local pointer and I think the original logical just want use the local variable as pointer to pointer.

I have reviewed the suggested change and think both are the same logic.

Hi Qin,

Can you give some comment?

Best Regards
guomin
From: sean.brogan via [] <sean.brogan=microsoft.com@[]<mailto:sean.brogan=microsoft.com@[]>>
Sent: Wednesday, April 8, 2020 2:00 PM
To: Jiang, Guomin <guomin.jiang@intel.com<mailto:guomin.jiang@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Guomin,

Can you speak to why you implemented differently than the suggested and validated patch?  Seems you created a local whereas ours just used the internal data member.

Thanks
sean

[-- Attachment #2: Type: text/html, Size: 4538 bytes --]

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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.
  2020-04-10  7:17       ` Kun Qin
@ 2020-04-13  6:20         ` Guomin Jiang
  2020-04-13  6:47           ` Kun Qin
  0 siblings, 1 reply; 6+ messages in thread
From: Guomin Jiang @ 2020-04-13  6:20 UTC (permalink / raw)
  To: Kun Qin, Sean Brogan, devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]

Hi Qin,

Refer https://github.com/guominjia/edk2/commit/eed5154853f6522e6150b9cff16d24e0c88ad3cc

Best Regards
guomin

From: Kun Qin <Kun.Qin@microsoft.com>
Sent: Friday, April 10, 2020 3:18 PM
To: Jiang, Guomin <guomin.jiang@intel.com>; Sean Brogan <sean.brogan@microsoft.com>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Hi Guomin,

Could you please point me to the proposed change?

Thanks,
Kun

From: Jiang, Guomin <guomin.jiang@intel.com<mailto:guomin.jiang@intel.com>>
Sent: Wednesday, April 8, 2020 6:30 PM
To: Sean Brogan <sean.brogan@microsoft.com<mailto:sean.brogan@microsoft.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kun Qin <Kun.Qin@microsoft.com<mailto:Kun.Qin@microsoft.com>>
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Hi Sean,

I think it meet the original code logic more closely.

According to the LoadUnitTestCache(), it need pointer to pointer, the defect is resulted by pointer to local pointer and I think the original logical just want use the local variable as pointer to pointer.

I have reviewed the suggested change and think both are the same logic.

Hi Qin,

Can you give some comment?

Best Regards
guomin
From: sean.brogan via [] <sean.brogan=microsoft.com@[]<mailto:sean.brogan=microsoft.com@[]>>
Sent: Wednesday, April 8, 2020 2:00 PM
To: Jiang, Guomin <guomin.jiang@intel.com<mailto:guomin.jiang@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Guomin,

Can you speak to why you implemented differently than the suggested and validated patch?  Seems you created a local whereas ours just used the internal data member.

Thanks
sean

[-- Attachment #2: Type: text/html, Size: 6216 bytes --]

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

* Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.
  2020-04-13  6:20         ` Guomin Jiang
@ 2020-04-13  6:47           ` Kun Qin
  0 siblings, 0 replies; 6+ messages in thread
From: Kun Qin @ 2020-04-13  6:47 UTC (permalink / raw)
  To: Jiang, Guomin, Sean Brogan, devel@edk2.groups.io

[-- Attachment #1: Type: text/plain, Size: 3112 bytes --]

Hi Guomin,

Thanks for point the commit below to me. I agree that the change is functionally the same, and I am also with Sean that the local variable seems redundant. But is there other reason we used this local variable in the first place? I thought the first implementation<https://github.com/microsoft/mu_basecore/blob/608b28d6e2b977dfb05d806bf4d1c4fd12c87462/MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.c#L263> did not have it.

Thanks,
Kun

From: Jiang, Guomin <guomin.jiang@intel.com>
Sent: Sunday, April 12, 2020 11:21 PM
To: Kun Qin <Kun.Qin@microsoft.com>; Sean Brogan <sean.brogan@microsoft.com>; devel@edk2.groups.io
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Hi Qin,

Refer https://github.com/guominjia/edk2/commit/eed5154853f6522e6150b9cff16d24e0c88ad3cc<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fguominjia%2Fedk2%2Fcommit%2Feed5154853f6522e6150b9cff16d24e0c88ad3cc&data=02%7C01%7CKun.Qin%40microsoft.com%7C65d030006a89412c383c08d7df72d1a1%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637223556552433909&sdata=%2BVqQE4pRZt6nueZrfqywcsyd6D2zlDYDbOjfHgZTPGE%3D&reserved=0>

Best Regards
guomin

From: Kun Qin <Kun.Qin@microsoft.com<mailto:Kun.Qin@microsoft.com>>
Sent: Friday, April 10, 2020 3:18 PM
To: Jiang, Guomin <guomin.jiang@intel.com<mailto:guomin.jiang@intel.com>>; Sean Brogan <sean.brogan@microsoft.com<mailto:sean.brogan@microsoft.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Hi Guomin,

Could you please point me to the proposed change?

Thanks,
Kun

From: Jiang, Guomin <guomin.jiang@intel.com<mailto:guomin.jiang@intel.com>>
Sent: Wednesday, April 8, 2020 6:30 PM
To: Sean Brogan <sean.brogan@microsoft.com<mailto:sean.brogan@microsoft.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Kun Qin <Kun.Qin@microsoft.com<mailto:Kun.Qin@microsoft.com>>
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Hi Sean,

I think it meet the original code logic more closely.

According to the LoadUnitTestCache(), it need pointer to pointer, the defect is resulted by pointer to local pointer and I think the original logical just want use the local variable as pointer to pointer.

I have reviewed the suggested change and think both are the same logic.

Hi Qin,

Can you give some comment?

Best Regards
guomin
From: sean.brogan via [] <sean.brogan=microsoft.com@[]<mailto:sean.brogan=microsoft.com@[]>>
Sent: Wednesday, April 8, 2020 2:00 PM
To: Jiang, Guomin <guomin.jiang@intel.com<mailto:guomin.jiang@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer.

Guomin,

Can you speak to why you implemented differently than the suggested and validated patch?  Seems you created a local whereas ours just used the internal data member.

Thanks
sean

[-- Attachment #2: Type: text/html, Size: 7561 bytes --]

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

end of thread, other threads:[~2020-04-13  6:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <160150CCACE2328E.16021@groups.io>
2020-04-08  5:29 ` [edk2-devel] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Correct dereferred pointer Guomin Jiang
2020-04-08  5:59   ` Sean
2020-04-09  1:29     ` Guomin Jiang
2020-04-10  7:17       ` Kun Qin
2020-04-13  6:20         ` Guomin Jiang
2020-04-13  6:47           ` Kun Qin

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