[edk2-devel] [PATCH 3/3] MdeModulePkg: Use CopyGuid instead of GUID assignment

Schaefer, Daniel Helmut (DualStudy) posted 3 patches 4 years, 9 months ago
There is a newer version of this series
[edk2-devel] [PATCH 3/3] MdeModulePkg: Use CopyGuid instead of GUID assignment
Posted by Schaefer, Daniel Helmut (DualStudy) 4 years, 9 months ago
GCC translates a simple assignment to memcpy, which EDKII doesn't provide.
See: https://www.mail-archive.com/edk2-devel@lists.01.org/msg11928.html

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

Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Gilbert Chen <gilbert.chen@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
---
 MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
index 5cc527679a78..d36648aaa04a 100644
--- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
+++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
@@ -619,7 +619,7 @@ CreateDeviceManagerForm(
         TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);

         FreePool (String);

 

-        FormSetGuid = ((EFI_IFR_FORM_SET *)Ptr)->Guid;

+        CopyGuid (&FormSetGuid, &((EFI_IFR_FORM_SET *) Ptr)->Guid);

 

         //

         // Network device process

-- 
2.25.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54731): https://edk2.groups.io/g/devel/message/54731
Mute This Topic: https://groups.io/mt/71474829/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 3/3] MdeModulePkg: Use CopyGuid instead of GUID assignment
Posted by Dandan Bi 4 years, 9 months ago
> -----Original Message-----
> From: Daniel Schaefer [mailto:daniel.schaefer@hpe.com]
> Sent: Sunday, February 23, 2020 12:59 AM
> To: devel@edk2.groups.io
> Cc: Abner Chang <abner.chang@hpe.com>; Gilbert Chen
> <gilbert.chen@hpe.com>; Leif Lindholm <leif@nuviainc.com>; Bi, Dandan
> <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>
> Subject: [PATCH 3/3] MdeModulePkg: Use CopyGuid instead of GUID
> assignment
> 
> GCC translates a simple assignment to memcpy, which EDKII doesn't provide.
> See: https://www.mail-archive.com/edk2-devel@lists.01.org/msg11928.html
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2547
> 
> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
> Cc: Abner Chang <abner.chang@hpe.com>
> Cc: Gilbert Chen <gilbert.chen@hpe.com>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> ---
>  MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
> b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
> index 5cc527679a78..d36648aaa04a 100644
> --- a/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
> +++ b/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c
> @@ -619,7 +619,7 @@ CreateDeviceManagerForm(
>          TokenHelp = HiiSetString (HiiHandle, 0, String, NULL);
> 
>          FreePool (String);
> 
> 
> 
> -        FormSetGuid = ((EFI_IFR_FORM_SET *)Ptr)->Guid;
> 
> +        CopyGuid (&FormSetGuid, &((EFI_IFR_FORM_SET *) Ptr)->Guid);
Hi, 

Could you please use CopyMem instead of CopyGuid? Or it will meet following warning with VS compiler.
DeviceManager.c(622): warning C4366: The result of the unary '&' operator may be unaligned

Thanks,
Dandan
> 
> 
> 
>          //
> 
>          // Network device process
> 
> --
> 2.25.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54786): https://edk2.groups.io/g/devel/message/54786
Mute This Topic: https://groups.io/mt/71474829/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-