[U-Boot] hashtable: fix environment variable corruption

Tom Rini trini at konsulko.com
Sun Feb 10 13:08:39 UTC 2019


On Wed, Jan 30, 2019 at 11:39:54AM +0100, Roman Kapl wrote:

> Only first previously deleted entry was recognized, leading hsearch_r
> to think that there was no previously deleted entry. It then conluded
> that a free entry was found, even if there were no free entries and it
> overwrote a random entry.
> 
> This patch makes sure all deleted or free entries are always found and
> also introduces constants for the 0 and -1 numbers. Unit tests to excersise a
> simple hash table usage and catch the corruption were added.
> 
> To trash your environment, simply run this loop:
> 
> setenv i 0
> while true; do
>     setenv v_$i $i
>     setenv v_$i
>     setexpr i $i + 1
> done
> 
> Signed-off-by: Roman Kapl <rka at sysgo.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190210/9b659d78/attachment.sig>


More information about the U-Boot mailing list