public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c
@ 2024-02-27  6:37 Chao Li
  2024-02-27  7:50 ` G Edhaya Chandran
  2024-02-27 14:04 ` Heinrich Schuchardt
  0 siblings, 2 replies; 7+ messages in thread
From: Chao Li @ 2024-02-27  6:37 UTC (permalink / raw)
  To: devel
  Cc: G Edhaya Chandran, Barton Gao, Carolyn Gjertsen,
	Samer El-Haj-Mahmoud, Eric Jin, Arvin Chen, Supreeth Venkatesh,
	Heinrich Schuchardt

DevicePathFromTextBBTextCoverage.c function CreateDNSDeviceNode has a
bug, code:

SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH)));

DNS is a pointer, which is increased by a structure size and converted
to EFI_IPv4_ADDRESS*, which will point to an unknown address. So fix it.

Fixes: 847e0363e846 ("SctPkg: Fix the UefiSct-Wincompatible-pointer-types warnings")

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4712

Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>
Cc: Barton Gao <gaojie@byosoft.com.cn>
Cc: Carolyn Gjertsen <Carolyn.Gjertsen@amd.com>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Cc: Eric Jin <eric.jin@intel.com>
Cc: Arvin Chen <arvinx.chen@intel.com>
Cc: Supreeth Venkatesh <Supreeth.Venkatesh@amd.com>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
---
 .../BlackBoxTest/DevicePathFromTextBBTestCoverage.c       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
index c96ee246..bd11c25a 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
@@ -1734,13 +1734,13 @@ CreateDNSDeviceNode (
   }
 
   if (DNS->IsIPv6 == 0) {
-    SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH)));
-    SctStrToIPv4Addr (&IpStr2, (EFI_IPv4_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+    SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH)));
+    SctStrToIPv4Addr (&IpStr2, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
   }
 
   if (DNS->IsIPv6 == 1) {
-    SctStrToIPv6Addr (&IpStr1, (EFI_IPv6_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH)));
-    SctStrToIPv6Addr (&IpStr2, (EFI_IPv6_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
+    SctStrToIPv6Addr (&IpStr1, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH)));
+    SctStrToIPv6Addr (&IpStr2, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
   }
 
   return (EFI_DEVICE_PATH_PROTOCOL *) DNS;
-- 
2.27.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116004): https://edk2.groups.io/g/devel/message/116004
Mute This Topic: https://groups.io/mt/104598721/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c
  2024-02-27  6:37 [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c Chao Li
@ 2024-02-27  7:50 ` G Edhaya Chandran
  2024-02-27  8:03   ` Chao Li
  2024-02-27 14:04 ` Heinrich Schuchardt
  1 sibling, 1 reply; 7+ messages in thread
From: G Edhaya Chandran @ 2024-02-27  7:50 UTC (permalink / raw)
  To: Chao Li, devel

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

Hi Li Chao, Thank you for the solution.
Reviewed OK.

Reviewed-by: G Edhaya Chandran <edhaya.chandran@arm.com>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116007): https://edk2.groups.io/g/devel/message/116007
Mute This Topic: https://groups.io/mt/104598721/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

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

* Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c
  2024-02-27  7:50 ` G Edhaya Chandran
@ 2024-02-27  8:03   ` Chao Li
  2024-02-27  9:19     ` G Edhaya Chandran
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Li @ 2024-02-27  8:03 UTC (permalink / raw)
  To: devel, edhaya.chandran

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

Hi Edhaya,

Thanks for you review, I have created a PR on Github: 
https://github.com/tianocore/edk2-test/pull/87


Thanks,
Chao
On 2024/2/27 15:50, G Edhaya Chandran wrote:
> Hi Li Chao, Thank you for the solution.
> Reviewed OK.
>
> Reviewed-by: G Edhaya Chandran <edhaya.chandran@arm.com>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116008): https://edk2.groups.io/g/devel/message/116008
Mute This Topic: https://groups.io/mt/104598721/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

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

* Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c
  2024-02-27  8:03   ` Chao Li
@ 2024-02-27  9:19     ` G Edhaya Chandran
  2024-02-27  9:25       ` Chao Li
  0 siblings, 1 reply; 7+ messages in thread
From: G Edhaya Chandran @ 2024-02-27  9:19 UTC (permalink / raw)
  To: Chao Li, devel@edk2.groups.io

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

Hi Li Chao,

    As per the maintenance process, I will raise a PR on your behalf based on your patch.
And will later close your PR.

With Warm Regards,
Edhay


From: Chao Li <lichao@loongson.cn>
Sent: Tuesday, February 27, 2024 1:34 PM
To: devel@edk2.groups.io; G Edhaya Chandran <Edhaya.Chandran@arm.com>
Subject: Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c


Hi Edhaya,

Thanks for you review, I have created a PR on Github: https://github.com/tianocore/edk2-test/pull/87

Thanks,
Chao
On 2024/2/27 15:50, G Edhaya Chandran wrote:
Hi Li Chao, Thank you for the solution.
Reviewed OK.

Reviewed-by: G Edhaya Chandran <edhaya.chandran@arm.com><mailto:edhaya.chandran@arm.com>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116012): https://edk2.groups.io/g/devel/message/116012
Mute This Topic: https://groups.io/mt/104598721/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

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

* Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c
  2024-02-27  9:19     ` G Edhaya Chandran
@ 2024-02-27  9:25       ` Chao Li
  2024-02-27 10:29         ` G Edhaya Chandran
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Li @ 2024-02-27  9:25 UTC (permalink / raw)
  To: G Edhaya Chandran, devel@edk2.groups.io

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

Hi Edhay,

OK, thank you!


Thanks,
Chao
On 2024/2/27 17:19, G Edhaya Chandran wrote:
>
> Hi Li Chao,
>
>     As per the maintenance process, I will raise a PR on your behalf 
> based on your patch.
>
> And will later close your PR.
>
> With Warm Regards,
> Edhay
>
> *From:* Chao Li <lichao@loongson.cn>
> *Sent:* Tuesday, February 27, 2024 1:34 PM
> *To:* devel@edk2.groups.io; G Edhaya Chandran <Edhaya.Chandran@arm.com>
> *Subject:* Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter 
> error in DevicePathFromTextBBTestCoverage.c
>
> Hi Edhaya,
>
> Thanks for you review, I have created a PR on Github: 
> https://github.com/tianocore/edk2-test/pull/87
>
> Thanks,
> Chao
>
> On 2024/2/27 15:50, G Edhaya Chandran wrote:
>
>     Hi Li Chao, Thank you for the solution.
>     Reviewed OK.
>
>     Reviewed-by: G Edhaya Chandran <edhaya.chandran@arm.com>
>     <mailto:edhaya.chandran@arm.com>
>
>     
>
> IMPORTANT NOTICE: The contents of this email and any attachments are 
> confidential and may also be privileged. If you are not the intended 
> recipient, please notify the sender immediately and do not disclose 
> the contents to any other person, use it for any purpose, or store or 
> copy the information in any medium. Thank you. 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116013): https://edk2.groups.io/g/devel/message/116013
Mute This Topic: https://groups.io/mt/104598721/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

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

* Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c
  2024-02-27  9:25       ` Chao Li
@ 2024-02-27 10:29         ` G Edhaya Chandran
  0 siblings, 0 replies; 7+ messages in thread
From: G Edhaya Chandran @ 2024-02-27 10:29 UTC (permalink / raw)
  To: Chao Li, devel

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

The patch is upstreamed through the commit:
https://github.com/tianocore/edk2-test/commit/cabb98d44be94e7547605435a0be7c4946d10f8b


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116022): https://edk2.groups.io/g/devel/message/116022
Mute This Topic: https://groups.io/mt/104598721/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

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

* Re: [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c
  2024-02-27  6:37 [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c Chao Li
  2024-02-27  7:50 ` G Edhaya Chandran
@ 2024-02-27 14:04 ` Heinrich Schuchardt
  1 sibling, 0 replies; 7+ messages in thread
From: Heinrich Schuchardt @ 2024-02-27 14:04 UTC (permalink / raw)
  To: Chao Li
  Cc: G Edhaya Chandran, Barton Gao, Carolyn Gjertsen,
	Samer El-Haj-Mahmoud, Eric Jin, Arvin Chen, Supreeth Venkatesh,
	devel

On 27.02.24 07:37, Chao Li wrote:
> DevicePathFromTextBBTextCoverage.c function CreateDNSDeviceNode has a
> bug, code:
> 
> SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH)));
> 
> DNS is a pointer, which is increased by a structure size and converted
> to EFI_IPv4_ADDRESS*, which will point to an unknown address. So fix it.
> 
> Fixes: 847e0363e846 ("SctPkg: Fix the UefiSct-Wincompatible-pointer-types warnings")
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4712
> 
> Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>
> Cc: Barton Gao <gaojie@byosoft.com.cn>
> Cc: Carolyn Gjertsen <Carolyn.Gjertsen@amd.com>
> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
> Cc: Eric Jin <eric.jin@intel.com>
> Cc: Arvin Chen <arvinx.chen@intel.com>
> Cc: Supreeth Venkatesh <Supreeth.Venkatesh@amd.com>
> Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> Signed-off-by: Chao Li <lichao@loongson.cn>
> ---
>   .../BlackBoxTest/DevicePathFromTextBBTestCoverage.c       | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
> index c96ee246..bd11c25a 100644
> --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/DevicePathFromText/BlackBoxTest/DevicePathFromTextBBTestCoverage.c
> @@ -1734,13 +1734,13 @@ CreateDNSDeviceNode (
>     }
>   
>     if (DNS->IsIPv6 == 0) {
> -    SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH)));
> -    SctStrToIPv4Addr (&IpStr2, (EFI_IPv4_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
> +    SctStrToIPv4Addr (&IpStr1, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH)));
> +    SctStrToIPv4Addr (&IpStr2, (EFI_IPv4_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
>     }
>   
>     if (DNS->IsIPv6 == 1) {
> -    SctStrToIPv6Addr (&IpStr1, (EFI_IPv6_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH)));
> -    SctStrToIPv6Addr (&IpStr2, (EFI_IPv6_ADDRESS *)(DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
> +    SctStrToIPv6Addr (&IpStr1, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH)));
> +    SctStrToIPv6Addr (&IpStr2, (EFI_IPv6_ADDRESS *)((UINT8 *)DNS + sizeof (DNS_DEVICE_PATH) + sizeof(EFI_IP_ADDRESS)));
>     }
>   
>     return (EFI_DEVICE_PATH_PROTOCOL *) DNS;

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116044): https://edk2.groups.io/g/devel/message/116044
Mute This Topic: https://groups.io/mt/104598721/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2024-02-27 14:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27  6:37 [edk2-devel] [edk2-test v2] SctPkg: Fixed a pinter error in DevicePathFromTextBBTestCoverage.c Chao Li
2024-02-27  7:50 ` G Edhaya Chandran
2024-02-27  8:03   ` Chao Li
2024-02-27  9:19     ` G Edhaya Chandran
2024-02-27  9:25       ` Chao Li
2024-02-27 10:29         ` G Edhaya Chandran
2024-02-27 14:04 ` Heinrich Schuchardt

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