[coreboot] seemingly wrong code in src/arch/i386/boot/coreboot_table.c
ron minnich
rminnich at gmail.com
Sat May 9 07:27:04 CEST 2009
Found the problem. 4240 broke builtd_option_tbl due to the addition of
error checking which got the sense of fwrite wrong.
fwrite returns 0 on error, non-zero otherwise; the code was written to
assume non-zero was an error.
patch attached inline, qemu is booting again.
If somebody wants to ack this and commit it that is fine with me.
Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
Index: util/options/build_opt_tbl.c
===================================================================
--- util/options/build_opt_tbl.c (revision 4263)
+++ util/options/build_opt_tbl.c (working copy)
@@ -511,13 +511,13 @@
}
/* write the array values */
for(i=0;i<(ct->size-1);i++) {
- if(!(i%10) && !err) err=fwrite("\n\t",1,2,fp);
+ if(!(i%10) && !err) err=!fwrite("\n\t",1,2,fp);
sprintf(buf,"0x%02x,",cmos_table[i]);
- if(!err) err=fwrite(buf,1,5,fp);
+ if(!err) err=!fwrite(buf,1,5,fp);
}
/* write the end */
sprintf(buf,"0x%02x\n",cmos_table[i]);
- if(!err) err=fwrite(buf,1,4,fp);
+ if(!err) err=!fwrite(buf,1,4,fp);
if(!fwrite("};\n",1,3,fp)) {
perror("Error - Could not write image file");
fclose(fp);
More information about the coreboot
mailing list