]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix fzap handling
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 5 Dec 2010 14:35:08 +0000 (15:35 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 5 Dec 2010 14:35:08 +0000 (15:35 +0100)
grub-core/fs/zfs/zfs.c
include/grub/zfs/zap_leaf.h

index 8f20085fab86f927b633afc1a0e8959cc5490ae0..c47b4afc9b6a5b55ed25667eb7b56c1ca3505af9 100644 (file)
@@ -961,7 +961,8 @@ fzap_iterate (dnode_end_t * zap_dnode, zap_phys_t * zap,
       grub_error (GRUB_ERR_BAD_FS, "ZAP leaf is too small");
       return 0;
     }
-  for (idx = 0; idx < zap->zap_ptrtbl.zt_numblks; idx++)
+  for (idx = 0; idx < grub_zfs_to_cpu64 (zap->zap_num_leafs,
+                                        zap_dnode->endian); idx++)
     {
       blkid = ((grub_uint64_t *) zap)[idx + (1 << (blksft - 3 - 1))];
 
@@ -2553,6 +2554,7 @@ static struct grub_fs grub_zfs_fs = {
 
 GRUB_MOD_INIT (zfs)
 {
+  COMPILE_TIME_ASSERT (sizeof (zap_leaf_chunk_t) == ZAP_LEAF_CHUNKSIZE);
   grub_fs_register (&grub_zfs_fs);
 #ifndef GRUB_UTIL
   my_mod = mod;
index 1ef65405494b0b744f6da9b4f9b471561b86f894..5adfdc2900f7d25c7199fe8cdbabe09d0502834a 100644 (file)
@@ -90,7 +90,7 @@ typedef union zap_leaf_chunk {
                {
                        grub_uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
                        grub_uint64_t la_array64;
-               };
+               } __attribute__ ((packed));
                grub_uint16_t la_next;          /* next blk or CHAIN_END */
        } l_array;
        struct zap_leaf_free {