From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1IkCq8-00070j-9T for mharc-grub-devel@gnu.org; Tue, 23 Oct 2007 02:02:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IkCq5-0006zg-QC for grub-devel@gnu.org; Tue, 23 Oct 2007 02:02:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IkCq4-0006zE-IH for grub-devel@gnu.org; Tue, 23 Oct 2007 02:02:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IkCq4-0006z7-Bx for grub-devel@gnu.org; Tue, 23 Oct 2007 02:02:04 -0400 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IkCq3-0006gO-RK for grub-devel@gnu.org; Tue, 23 Oct 2007 02:02:04 -0400 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1IkCPx-0004pZ-T4 for grub-devel@gnu.org; Tue, 23 Oct 2007 07:35:06 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1IkCPq-00052V-J0 for grub-devel@gnu.org; Tue, 23 Oct 2007 07:34:58 +0200 Date: Tue, 23 Oct 2007 07:34:58 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20071023053458.GB19186@thorin> References: <471D0F5B.20805@t-online.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <471D0F5B.20805@t-online.de> Organization: free as in freedom X-Message-Flag: Microsoft discourages use of Outlook. X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] Fix packing issue of machine_mmap_entry X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Oct 2007 06:02:06 -0000 On Mon, Oct 22, 2007 at 11:00:11PM +0200, Christian Franke wrote: > --- grub2.orig/include/grub/i386/pc/init.h 2007-07-22 01:32:23.000000000 +0200 > +++ grub2/include/grub/i386/pc/init.h 2007-10-13 21:25:24.000000000 +0200 > @@ -40,10 +40,14 @@ grub_uint32_t grub_get_eisa_mmap (void); > struct grub_machine_mmap_entry > { > grub_uint32_t size; > - grub_uint64_t addr; > + grub_uint64_t addr; /* must be at offset 4, see startup.S */ > grub_uint64_t len; > grub_uint32_t type; > -}; > +} __attribute__((packed)); Looks fine to me (I suppose we would have the same problem on x86_64). > +/* Compile time assert to check packing */ > +typedef char ASSERT_sizeof_grub_machine_mmap_entry[ > + sizeof (struct grub_machine_mmap_entry) == 4+8+8+4 ? 1 : -1]; Nice, I didn't know you could do compile time assertion in C. But is it really necessary to check for gcc bugs? That __attribute__((packed)) can only have the expected effect, right? Besides, in this case maybe it'd be better to use autoconf. -- Robert Millan I know my rights; I want my phone call! What use is a phone call, if you are unable to speak? (as seen on /.)