[U-Boot] [PATCH] common: nvedit to protect additional ethernet addresses Part 1/1
Stefan Althoefer
stefan.althoefer at web.de
Mon Dec 8 00:52:20 CET 2008
Hi Wolfgang Denk
> Dear Stefan Althoefer,
>
> In message <ghh632$ims$1 at ger.gmane.org> you wrote:
>> You argue that the code should have a couple of hard to read else cases?
>
> That would be one way to avoid unnecessary tests.
>
> Probably not the most elegant approach, agreed.
>
> There are other options, though.
But your suggested optimizations will only be effective if someone tries to
write to "serial#". This is not normally done (attempt can be considered
an error).
If access to any nonprotected environment variables is requested (and speed
does matter here) then any of the protected cases must be tested.
Even you code:
--------
if( "serial#" )
...
else if( "ethaddr" )
...
else if( "eth[0-9]+addr" )
...
---------
then all the ifs are triggered if you write to "videomode".
--- Stefan
More information about the U-Boot
mailing list