2009-02-27 Krzysztof Smiechowicz <deadwood@wp.pl>

* fs/sfs.c (grub_sfs_read_extent): Correction to traversing extent
        b-tree.
This commit is contained in:
robertmh 2009-02-27 19:50:53 +00:00
parent 8cc50345f8
commit 34519c3f9d
2 changed files with 7 additions and 10 deletions

View file

@ -1,3 +1,8 @@
2009-02-27 Krzysztof Smiechowicz <deadwood@wp.pl>
* fs/sfs.c (grub_sfs_read_extent): Correction to traversing extent
b-tree.
2009-02-27 Robert Millan <rmh@aybabtu.com> 2009-02-27 Robert Millan <rmh@aybabtu.com>
* kern/misc.c (grub_strtoull): Fix bug (it mistakenly parsed the * kern/misc.c (grub_strtoull): Fix bug (it mistakenly parsed the

View file

@ -172,7 +172,7 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
return grub_errno; return grub_errno;
} }
for (i = 0; i < grub_be_to_cpu16 (tree->nodes); i++) for (i = grub_be_to_cpu16 (tree->nodes) - 1; i >= 0; i--)
{ {
#define EXTNODE(tree, index) \ #define EXTNODE(tree, index) \
@ -180,16 +180,8 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
+ (index) * (tree)->nodesize)) + (index) * (tree)->nodesize))
/* Follow the tree down to the leaf level. */ /* Follow the tree down to the leaf level. */
if ((grub_be_to_cpu32 (EXTNODE(tree, i)->key) >= block) if ((grub_be_to_cpu32 (EXTNODE(tree, i)->key) <= block)
&& !tree->leaf) && !tree->leaf)
{
next = grub_be_to_cpu32 (EXTNODE (tree, i - 1)->data);
break;
}
/* In case the last node is reached just use that one, it is
the right match. */
if (i + 1 == grub_be_to_cpu16 (tree->nodes) && !tree->leaf)
{ {
next = grub_be_to_cpu32 (EXTNODE (tree, i)->data); next = grub_be_to_cpu32 (EXTNODE (tree, i)->data);
break; break;