[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix packing issue of machine_mmap_entry
From: |
Robert Millan |
Subject: |
Re: [PATCH] Fix packing issue of machine_mmap_entry |
Date: |
Tue, 23 Oct 2007 07:34:58 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
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
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)