[U-Boot] [U-Boot, v2] fs: btrfs: fix btrfs_search_tree invalid results

Tom Rini trini at konsulko.com
Sat Apr 27 14:46:34 UTC 2019


On Tue, Apr 16, 2019 at 02:47:14AM +0200, Pierre Bourdon wrote:

> btrfs_search_tree should return the first item in the tree that is
> greater or equal to the searched item.
> 
> The search algorithm did not properly handle the edge case where the
> searched item is higher than the last item of the node but lower than
> the first item of the next node. Instead of properly returning the first
> item of the next node, it was returning an invalid path pointer
> (pointing to a non-existent item after the last item of the node + 1).
> 
> This fixes two issues in the btrfs driver:
>   - Looking for a ROOT_ITEM could fail if it was the first item of its
>     leaf node.
>   - Iterating through DIR_INDEX entries (for readdir) could fail if the
>     first DIR_INDEX entry was the first item of a leaf node.
> 
> Signed-off-by: Pierre Bourdon <delroth at gmail.com>
> Cc: Marek Behun <marek.behun at nic.cz>

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/20190427/96ff5a34/attachment.sig>


More information about the U-Boot mailing list