[U-Boot] [PATCH v2 2/9] make the hwconfig buffer deeper

Wolfgang Denk wd at denx.de
Mon Jan 3 22:47:45 CET 2011


Dear York Sun,

In message <1294089991.24386.58.camel at oslab-l1> you wrote:
>
> > Hm... I have no idea whish sort of "buggy code" you are referring to
> > here, but in this case we shoul start and fix that buggy code, right?
> 
> Making a buffer in a function's stack and make use of it out of the
> scope, that's the buggy code I am referring. 

That is bad indeed, and needs to be fixed.

> > You fail to explain why we should change anything when you "don't need
> > more than 128 characters for hwconfig" in the first place?
> 
> I don't need more than 128 characters. However, the stack is trashed by
> other functions. I have to push the stack deeper to keep the content
> unchanged. I am not happy with it.

Now I understand what you mean.

But we do not need a bigger buffer, or store another copy of the whole
content of the "hwconfig" variable - we just need room to for the
return value of hwconfig_parse(), which usually should be (much)
smaller than the content of the "hwconfig" variable.

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
The price of curiosity is a terminal experience.
                         - Terry Pratchett, _The Dark Side of the Sun_


More information about the U-Boot mailing list