Patchwork Coreboot bug?

login
register
about
Submitter Myles Watson
Date 2009-11-11 23:56:26
Message ID <2831fecf0911111556w2af41be7y4b1afbddec224613@mail.gmail.com>
Download mbox | patch
Permalink /patch/555/
State Superseded
Headers show

Comments

Myles Watson - 2009-11-11 23:56:26
On Wed, Nov 11, 2009 at 4:37 PM, Peter Stuge <peter@stuge.se> wrote:
> ron minnich wrote:
>> >>> -             memcpy(rec_dest,  rec_src, rec_src->size);
>> >>> +             memcpy(rec_dest,  &option_table, sizeof(option_table));
>>
>> completely changes the behavior of the code and is wrong.
>>
>> I'm willing to be convinced. But sizeof(option_table) is 8
>
> How can that be?
 		/* Create cmos checksum entry in coreboot table */
 		lb_cmos_checksum(head);

sizeof(option_table) c
sizeof(&option_table) 4
sizeof(rec_dest) 4
sizeof(*rec_dest) 8
((u32*)option_table)[0] c8 (type)
((u32*)option_table)[1] 488 (size)
memcpy(00000518, 0010d91c, c)

I have no idea why 12.  I reverted it.

We could change it to index it as a u32 array, but I thought it would be easy...

Thanks,
Myles

Patch

Index: src/arch/i386/boot/coreboot_table.c
===================================================================
--- src/arch/i386/boot/coreboot_table.c	(revision 4935)
+++ src/arch/i386/boot/coreboot_table.c	(working copy)
@@ -488,6 +488,11 @@ 
 		struct lb_record *rec_dest;
 		/* Copy the option config table, it's already a lb_record... */
 		rec_dest = lb_new_record(head);
+		printk_debug("sizeof(option_table) %lx\n", sizeof(option_table));
+		printk_debug("sizeof(&option_table) %lx\n", sizeof(&option_table));
+		printk_debug("sizeof(rec_dest) %lx\n", sizeof(rec_dest));
+		printk_debug("((u32*)option_table)[0] %x (type)\n",
((u32*)&option_table)[0]);
+		printk_debug("((u32*)option_table)[1] %x (size)\n",
((u32*)&option_table)[1]);
 		memcpy(rec_dest,  &option_table, sizeof(option_table));