[U-Boot] [PATCH 5/5] New implementation for internal handling of environment variables.

Wolfgang Denk wd at denx.de
Tue Jul 20 22:35:16 CEST 2010


Dear Peter,

In message <1279658019.5685.125.camel at thunk> you wrote:
> 
> > I think the problem is that before relocation we have to use
> > getenv_r(), which is done for example to read the baudrate, see
> > arch/powerpc/lib/board.c: init_baudrate()
> 
> How hard is it to detect this case and generate a stackdump if someone
> calls getenv() before relocation is complete?  That would help to spot
> places where people are breaking the rules...

It's trivial to check - all we need to addd to getenv() is something
like

	if (!(gd->flags & GD_FLG_RELOC))
		bail_out();

But then, we could as well try to be friendly and eliminate
getenv_r(). We would just need a static buffer for the result.



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Reader, suppose you were an idiot. And suppose you were a  member  of
Congress. But I repeat myself.                           - Mark Twain


More information about the U-Boot mailing list