From: "Zeng, Star" <star.zeng@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH 1/3] MdeModulePkg/ResetUtilityLib: Add pack(1) for reset data structure
Date: Mon, 2 Jul 2018 07:33:43 +0000 [thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB6076F@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20180702032048.286200-2-ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
-----Original Message-----
From: Ni, Ruiyu
Sent: Monday, July 2, 2018 11:21 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>
Subject: [PATCH 1/3] 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 <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
index e3de4f117a..46a9ac6648 100644
--- a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
+++ b/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c
@@ -19,10 +19,14 @@
#include <Library/BaseMemoryLib.h>
#include <Library/ResetSystemLib.h>
+#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); }
--
2.16.1.windows.1
next prev parent reply other threads:[~2018-07-02 7:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 3:20 [PATCH 0/3] Bug fix and minor enhancements to ResetSystem code Ruiyu Ni
2018-07-02 3:20 ` [PATCH 1/3] MdeModulePkg/ResetUtilityLib: Add pack(1) for reset data structure Ruiyu Ni
2018-07-02 7:33 ` Zeng, Star [this message]
2018-07-02 3:20 ` [PATCH 2/3] MdeModulePkg/[Pei|Dxe]ResetSystemLib: Add PPI/Protocol dependency Ruiyu Ni
2018-07-02 7:33 ` Zeng, Star
2018-07-02 3:20 ` [PATCH 3/3] MdeModulePkg/ResetSystemRuntimeDxe: Add more info in debug message Ruiyu Ni
2018-07-02 7:35 ` Zeng, Star
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0C09AFA07DD0434D9E2A0C6AEB0483103BB6076F@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox