From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8EE2A209605A1 for ; Mon, 2 Jul 2018 00:33:55 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2018 00:33:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,298,1526367600"; d="scan'208";a="63736167" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 02 Jul 2018 00:33:54 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 00:33:50 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.223]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.82]) with mapi id 14.03.0319.002; Mon, 2 Jul 2018 15:33:43 +0800 From: "Zeng, Star" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [PATCH 1/3] MdeModulePkg/ResetUtilityLib: Add pack(1) for reset data structure Thread-Index: AQHUEbOqz605yE6mMk+RHibA8m2ejKR7ioLw Date: Mon, 2 Jul 2018 07:33:43 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB6076F@shsmsx102.ccr.corp.intel.com> References: <20180702032048.286200-1-ruiyu.ni@intel.com> <20180702032048.286200-2-ruiyu.ni@intel.com> In-Reply-To: <20180702032048.286200-2-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 1/3] MdeModulePkg/ResetUtilityLib: Add pack(1) for reset data structure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 07:33:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Ni, Ruiyu=20 Sent: Monday, July 2, 2018 11:21 AM To: edk2-devel@lists.01.org Cc: Zeng, Star Subject: [PATCH 1/3] MdeModulePkg/ResetUtilityLib: Add pack(1) for reset da= ta 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 t= o replace &ResetData.ResetSubType to resolve C4366 VS compiler warning. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng --- MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/ResetUtilityLib/ResetUtility.c b/MdeModul= ePkg/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 #include =20 +#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); =20 /** 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; =20 ResetData.NullTerminator =3D CHAR_NULL; - CopyGuid (&ResetData.ResetSubtype, ResetSubtype); + CopyGuid ( + (GUID *)((UINT8 *)&ResetData + OFFSET_OF (RESET_UTILITY_GUID_SPECIFIC_= RESET_DATA, ResetSubtype)), + ResetSubtype + ); ResetPlatformSpecific (sizeof (ResetData), &ResetData); } =20 -- 2.16.1.windows.1