On 03/06/2013 09:29 AM, Jens Rottmann wrote:
Hi Martin (and all),

I wrote:
You dereference dev in line 132, so if it's really 0,
will you then ever reach this check?? (I don't know if
in romstage *NULL is caught.)
You wrote:
yes, if it's 0, we still reach the code. I've changed it
to not dereference it before checking it though.
Per default, after any *ptr, GCC assumes a SEGFAULT would occur if ptr was ==0, so 
if control flow does reach the following code ptr must be !=0. ==> After any 
*ptr GCC will optimize away all ptr==0 or !=0 checks.  I know that because I 
recently hunted a related bug for a week (U-Boot, ARM, different project) until I 
looked at the actual assembly code.

Are you sure romstage (or maybe even ramstage?) will *NULL without segfaulting 
and just continue? And is romstage compiled with GCC (+ CAR) or is romcc used?

In that case "-fno-delete-null-pointer-checks" must be added to the GCC options.
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

I greped a bit, looks like it's not in any Makefiles yet.

Could someone who knows Coreboot's make/build system better than me maybe help, 
please?

Thanks
Jens

Jens,
I'm pretty sure, but I'm not *COMPLETELY* positive about this. I had to add this check because I kept getting null pointers due to an issue with the unterminated #pragma pack(1) in the porting.h file - that was messing my pointers up pretty badly. I'll work on checking this issue directly and respond back with what I find out.
Martin

--
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to