From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Tue, 20 Jul 2010 22:35:16 +0200 Subject: [U-Boot] [PATCH 5/5] New implementation for internal handling of environment variables. In-Reply-To: <1279658019.5685.125.camel@thunk> References: <1279395948-25864-1-git-send-email-wd@denx.de> <1279395948-25864-6-git-send-email-wd@denx.de> <20100719193825.120ebf29.kim.phillips@freescale.com> <20100720094023.61DD111D94C@gemini.denx.de> <20100720133648.cbb95a9f.kim.phillips@freescale.com> <20100720190112.3F435153A7F@gemini.denx.de> <20100720200908.40958153780@gemini.denx.de> <1279658019.5685.125.camel@thunk> Message-ID: <20100720203517.01B59153780@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Peter, In message <1279658019.5685.125.camel@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