]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-02-27 Krzysztof Smiechowicz <deadwood@wp.pl>
authorrobertmh <robertmh@localhost>
Fri, 27 Feb 2009 19:50:53 +0000 (19:50 +0000)
committerrobertmh <robertmh@localhost>
Fri, 27 Feb 2009 19:50:53 +0000 (19:50 +0000)
        * fs/sfs.c (grub_sfs_read_extent): Correction to traversing extent
        b-tree.

ChangeLog
fs/sfs.c

index cbf9a414d4a090c2f3ae0fcf402f71212e9d4b0d..e33065c600ac28f7c357dea36cd4ddd55ce133af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * kern/misc.c (grub_strtoull): Fix bug (it mistakenly parsed the
index 910bbf2c85ee91020c311da5679ac34e6f6e4743..d719e299e66b359dec45ff2f836ea0b680a611b2 100644 (file)
--- a/fs/sfs.c
+++ b/fs/sfs.c
@@ -172,7 +172,7 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
          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)                                           \
@@ -180,16 +180,8 @@ grub_sfs_read_extent (struct grub_sfs_data *data, unsigned int block,
                                         + (index) * (tree)->nodesize))
 
          /* 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)
-           {
-             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);
              break;