Hello, I would like to submit the following patch:
* fs/affs.c: Return failure when directory iteration failed. * fs/sfs.c: Return failure when directory iteration failed. Correct order in which btree nodes are read. These changes are needed to boot AROS Research Operating System from SFS / FFS. Best regards, Krzysztof
Index: fs/affs.c =================================================================== --- fs/affs.c (revision 1919) +++ fs/affs.c (working copy) @@ -381,7 +381,7 @@ fail: grub_free (node); grub_free (hashtable); - return 1; + return 0; } Index: fs/sfs.c =================================================================== --- fs/sfs.c (revision 1919) +++ fs/sfs.c (working copy) @@ -172,7 +172,8 @@ return grub_errno; } - for (i = 0; i < grub_be_to_cpu16 (tree->nodes); i++) + grub_uint16_t nodescount = grub_be_to_cpu16(tree->nodes); + for (i = nodescount - 1; i >= 0; i--) { #define EXTNODE(tree, index) \ @@ -180,17 +181,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; } @@ -451,7 +444,7 @@ fail: grub_free (objc_data); - return 1; + return 0; }
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel