From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=210.71.195.42; helo=out03.hibox.biz; envelope-from=tim.lewis@insyde.com; receiver=edk2-devel@lists.01.org Received: from out03.hibox.biz (out02.hibox.biz [210.71.195.42]) (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 13BB12194EB76 for ; Thu, 14 Mar 2019 14:09:08 -0700 (PDT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2BGAQCDwIpc/ws0GKxkGwEBAQEDAQE?= =?us-ascii?q?BBwMBAQGBZYIQaFAhEieDQ4lDjFA1AYMBiwWLbw0YCwgBhDoEAgKETyM4EgE?= =?us-ascii?q?BAwEBCQEDAm0cDIVKAQEBBAEBBgIdExwIEBcBBQYDDQQEAQFIDgERFggCBAE?= =?us-ascii?q?SCwWDE4F1D64VMxoChSqEaAWBL4Faiyo/gRGDEoMeAQSHPwORSDuSPQcCAoJ?= =?us-ascii?q?HAYUOhw6EORmLHgOIK4p/hXONHYFeIYFWcFCCbD+KTYVfIjCBIAgTjwwBAQ?= X-IronPort-AV: E=Sophos;i="5.58,479,1544457600"; d="scan'208";a="16401937" Received: from unknown (HELO hb3-BKT201.hibox.biz) ([172.24.52.11]) by out03.hibox.biz with ESMTP; 15 Mar 2019 05:09:06 +0800 Received: from unknown (HELO hb3-BKT101.hibox.biz) ([172.24.51.11]) by hb3-BKT201.hibox.biz with ESMTP; 15 Mar 2019 05:09:06 +0800 Received: from unknown (HELO hb3-IN05.hibox.biz) ([172.24.12.15]) by hb3-BKT101.hibox.biz with ESMTP; 15 Mar 2019 05:09:06 +0800 X-Remote-IP: 73.170.95.121 X-Remote-Host: c-73-170-95-121.hsd1.ca.comcast.net X-SBRS: -10.0 X-MID: 23822941 X-Auth-ID: tim.lewis@insyde.com X-EnvelopeFrom: tim.lewis@insyde.com hiBox-Sender: 1 Received: from c-73-170-95-121.hsd1.ca.comcast.net (HELO TIMSLAPTOP) ([73.170.95.121]) by hb3-IN05.hibox.biz with ESMTP/TLS/AES256-SHA; 15 Mar 2019 05:09:05 +0800 From: "Tim Lewis" To: "'TVKR'" , In-Reply-To: Date: Thu, 14 Mar 2019 14:08:52 -0700 Message-ID: <049701d4daaa$28b78bc0$7a26a340$@insyde.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJ59rrsJAGLIcXa7GGSwfdrX6ib/aTBZkjw Subject: Re: Data Structure alignment X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Mar 2019 21:09:10 -0000 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Language: en-us I believe the option ROM header itself has an alignment requirement greater than a DWORD. This is true whether it is from the option ROM BAR or whether it is copied into allocated memory via AllocatePool. In this case, the check you showed will still be adequate. But I am going from memory. Thanks, Tim -----Original Message----- From: edk2-devel On Behalf Of TVKR Sent: Thursday, March 14, 2019 1:47 PM To: edk2-devel@lists.01.org Subject: [edk2] Data Structure alignment Hi, The PCI FW spec says PCI Data Structure must be DWORD aligned and I came across this code the uses the following check (RomHeader->PcirOffset & 3) != 0 The above is using the PcirOffset to do the check and not the actual data structure itself (located at RomHeader + RomHeader->PcirOffset) Shouldn't it instead be (RomHeader + RomHeader->PcirOffset & 3) != 0 Thanks _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel