From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KDpw2-0000jF-8h for mharc-grub-devel@gnu.org; Tue, 01 Jul 2008 20:10:58 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KDpvz-0000fn-Qx for grub-devel@gnu.org; Tue, 01 Jul 2008 20:10:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KDpvy-0000ce-4k for grub-devel@gnu.org; Tue, 01 Jul 2008 20:10:55 -0400 Received: from [199.232.76.173] (port=41747 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KDpvx-0000cU-Ou for grub-devel@gnu.org; Tue, 01 Jul 2008 20:10:53 -0400 Received: from c60.cesmail.net ([216.154.195.49]:1453) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1KDpvx-0000Au-7w for grub-devel@gnu.org; Tue, 01 Jul 2008 20:10:53 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 01 Jul 2008 20:10:47 -0400 Received: from dv.roinet.com (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id 16A2E618F22 for ; Tue, 1 Jul 2008 20:10:47 -0400 (EDT) From: Pavel Roskin To: grub-devel@gnu.org Date: Tue, 01 Jul 2008 20:10:46 -0400 Message-ID: <20080702001046.7554.37059.stgit@dv.roinet.com> User-Agent: StGIT/0.14.3.163.g06f9 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] Fix warning in fs/xfs.c 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: Wed, 02 Jul 2008 00:10:56 -0000 ChangeLog: * fs/xfs.c (struct grub_xfs_dir_header): Use names similar to those in Linux XFS code. Provide a way to access 64-bit parent inode. (grub_xfs_iterate_dir): Use the new names. Avoid reading past the end of struct grub_xfs_dir_header. --- fs/xfs.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/xfs.c b/fs/xfs.c index 54d8031..7da3e40 100644 --- a/fs/xfs.c +++ b/fs/xfs.c @@ -55,9 +55,13 @@ struct grub_xfs_sblock struct grub_xfs_dir_header { - grub_uint8_t entries; - grub_uint8_t smallino; - grub_uint32_t parent; + grub_uint8_t count; + grub_uint8_t i8count; + union + { + grub_uint32_t i4; + grub_uint64_t i8; + } parent __attribute__ ((packed)); } __attribute__ ((packed)); struct grub_xfs_dir_entry @@ -419,7 +423,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, case XFS_INODE_FORMAT_INO: { struct grub_xfs_dir_entry *de = &diro->inode.data.dir.direntry[0]; - int smallino = !diro->inode.data.dir.dirhead.smallino; + int smallino = !diro->inode.data.dir.dirhead.i8count; int i; grub_uint64_t parent; @@ -427,12 +431,12 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, parent inode number is small too. */ if (smallino) { - parent = grub_be_to_cpu32 (diro->inode.data.dir.dirhead.parent); + parent = grub_be_to_cpu32 (diro->inode.data.dir.dirhead.parent.i4); parent = grub_cpu_to_be64 (parent); } else { - parent = *(grub_uint64_t *) &diro->inode.data.dir.dirhead.parent; + parent = diro->inode.data.dir.dirhead.parent.i8; /* The header is a bit bigger than usual. */ de = (struct grub_xfs_dir_entry *) ((char *) de + 4); } @@ -444,7 +448,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir, if (call_hook (parent, "..")) return 1; - for (i = 0; i < diro->inode.data.dir.dirhead.entries; i++) + for (i = 0; i < diro->inode.data.dir.dirhead.count; i++) { grub_uint64_t ino; void *inopos = (((char *) de)