[2003] 2009-02-27 Krzysztof Smiechowicz <[email protected]>

Robert Millan <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2003
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2003
Author:   robertmh
Date:     2009-02-27 19:50:53 +0000 (Fri, 27 Feb 2009)

Log Message:
-----------
2009-02-27  Krzysztof Smiechowicz <[email protected]>

        * fs/sfs.c (grub_sfs_read_extent): Correction to traversing extent
        b-tree.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/fs/sfs.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-02-27 19:33:38 UTC (rev 2002)
+++ trunk/grub2/ChangeLog	2009-02-27 19:50:53 UTC (rev 2003)
@@ -1,3 +1,8 @@
+2009-02-27  Krzysztof Smiechowicz <[email protected]>
+
+	* fs/sfs.c (grub_sfs_read_extent): Correction to traversing extent
+	b-tree.
+
 2009-02-27  Robert Millan  <[email protected]>
 
 	* kern/misc.c (grub_strtoull): Fix bug (it mistakenly parsed the

Modified: trunk/grub2/fs/sfs.c
===================================================================
--- trunk/grub2/fs/sfs.c	2009-02-27 19:33:38 UTC (rev 2002)
+++ trunk/grub2/fs/sfs.c	2009-02-27 19:50:53 UTC (rev 2003)
@@ -172,7 +172,7 @@
 	  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,17 +180,9 @@
 					 + (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;
 	    }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.