From 93f5a54ff3386a44b08de22e9b9230e3ed92b90c Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Mon, 2 Jul 2018 11:13:17 +0800 Subject: MdeModulePkg/ResetUtilityLib: Add pack(1) for reset data structure RESET_UTILITY_GUID_SPECIFIC_RESET_DATA structure should be declared as pack(1). The patch adds the missing pack(1) pragma. (GUID *)((UINT8 *)&ResetData + OFFSET_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, ResetSubtype)) is used to replace &ResetData.ResetSubType to resolve C4366 VS compiler warning. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Reviewed-by: Star Zeng --- MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'MdeModulePkg/Library') diff --git a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c index e3de4f1..46a9ac6 100644 --- a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c +++ b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c @@ -19,10 +19,14 @@ #include #include +#pragma pack(1) typedef struct { CHAR16 NullTerminator; GUID ResetSubtype; } RESET_UTILITY_GUID_SPECIFIC_RESET_DATA; +#pragma pack() + +VERIFY_SIZE_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, 18); /** This is a shorthand helper function to reset with a subtype so that @@ -49,7 +53,10 @@ ResetPlatformSpecificGuid ( RESET_UTILITY_GUID_SPECIFIC_RESET_DATA ResetData; ResetData.NullTerminator = CHAR_NULL; - CopyGuid (&ResetData.ResetSubtype, ResetSubtype); + CopyGuid ( + (GUID *)((UINT8 *)&ResetData + OFFSET_OF (RESET_UTILITY_GUID_SPECIFIC_RESET_DATA, ResetSubtype)), + ResetSubtype + ); ResetPlatformSpecific (sizeof (ResetData), &ResetData); } -- cgit v1.1