[coreboot] Coreboot bug?

Peter Stuge peter at stuge.se
Thu Nov 12 00:06:33 CET 2009


Myles Watson wrote:
> How about this:
> 
> Index: src/arch/i386/boot/coreboot_table.c
> ===================================================================
> --- src/arch/i386/boot/coreboot_table.c	(revision 4931)
> +++ src/arch/i386/boot/coreboot_table.c	(working copy)
> @@ -485,11 +485,10 @@
> 
>  #if (CONFIG_HAVE_OPTION_TABLE == 1)
>  	{
> -		struct lb_record *rec_dest, *rec_src;
> -		/* Write the option config table... */
> +		struct lb_record *rec_dest;
> +		/* Copy the option config table, it's already a lb_record... */
>  		rec_dest = lb_new_record(head);
> -		rec_src = (struct lb_record *)(void *)&option_table;
> -		memcpy(rec_dest,  rec_src, rec_src->size);
> +		memcpy(rec_dest,  &option_table, sizeof(option_table));

It is completely unclear to me why it is safe to write beyond the
struct lb_record (maybe it is an elaborate side-effect of the call to
lb_new_record()?) but the code did it before and this new code does
the same thing.

Acked-by: Peter Stuge <peter at stuge.se>




More information about the coreboot mailing list