[U-Boot] [PATCH 1/2] net: Remove call of srand from eth_random_enetaddr()

Christian Riesch christian.riesch at omicron.at
Wed Jan 9 08:05:27 CET 2013


Hello Wolfgang,
Thank you for your comments.

On Tuesday, January 8, 2013, Wolfgang Denk wrote:

> Dear Christian Riesch,
>
> In message <419e5c6e-b2ef-44c2-a4c1-bb25c50fcb57 at mary.at.omicron.at<javascript:;>>
> you wrote:
> > Currently eth_random_enetaddr() seeds the random number generator with
> > get_timer(0). Some boards might want to use other sources for the seed,
> > therefore move the call of srand() to the board specific code.
> >
> > Signed-off-by: Christian Riesch <christian.riesch at omicron.at<javascript:;>
> >
> > Cc: Michael Walle <michael at walle.cc>
> > Cc: Joe Hershberger <joe.hershberger at gmail.com <javascript:;>>
>
> I don't like this change.  What exactly is wrong with using the timer
> here?   It is probably much more random that the (so-called)
> "un-initialized" memory you suggest to use instead.


On the AM1808 SoC the counter is reset to zero on power up. So using it to
generate random numbers in code that is called interactively by the user is
fine and will yield a random MAC address, but in my case I will get the
same MAC address on each board at each power up.


> If there is really need to use another inital valu, only this should
> be fixed - but the srand() call itself should remain as is.
>
>
>
For other boards it may be ok to use a counter, and for some there may be
no SRAM or it may be already overwritten, e.g by the SPL... Therefore I am
not changing this for all boards, but make it board specific.

Regards, Christian


> You cannot do this.
>
> 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<javascript:;>
> You can observe a lot just by watchin'.                  - Yogi Berra
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de <javascript:;>
> http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list