From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1L3yZx-00075m-5a for mharc-grub-devel@gnu.org; Sat, 22 Nov 2008 14:55:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L3yZv-00074n-9v for grub-devel@gnu.org; Sat, 22 Nov 2008 14:55:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L3yZu-00074C-5B for grub-devel@gnu.org; Sat, 22 Nov 2008 14:55:38 -0500 Received: from [199.232.76.173] (port=46718 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L3yZu-000749-0N for grub-devel@gnu.org; Sat, 22 Nov 2008 14:55:38 -0500 Received: from mx1.wp.pl ([212.77.101.5]:56323) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L3yZt-0004i8-QY for grub-devel@gnu.org; Sat, 22 Nov 2008 14:55:38 -0500 Received: (wp-smtpd smtp.wp.pl 5914 invoked from network); 22 Nov 2008 20:55:19 +0100 Received: from 87-205-165-193.adsl.inetia.pl (HELO [192.168.1.2]) (deadwood@[87.205.165.193]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with AES256-SHA encrypted SMTP for ; 22 Nov 2008 20:55:19 +0100 Message-ID: <492863A7.7090902@wp.pl> Date: Sat, 22 Nov 2008 20:55:19 +0100 From: Krzysztof Smiechowicz User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="------------090707030207030700000204" X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000005 [YYcW] X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (1203?) Subject: [PATCH] Corrections to affs and sfs X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2008 19:55:39 -0000 This is a multi-part message in MIME format. --------------090707030207030700000204 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit 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 --------------090707030207030700000204 Content-Type: text/x-diff; name="affs-sfs.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="affs-sfs.diff" 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; } --------------090707030207030700000204--