Is EXT4_FITS_IN_INODE() broken?
Is EXT4_FITS_IN_INODE() broken? It makes use of i_extra_isize - which is an optional field and doesn't exist if the filesystem was made with "-I 128".
(gdb) p &((struct ext4_inode *)0)->i_extra_isize $2 = (__le16 *) 0x80 <irq_stack_union+128>
Should EXT4_FITS_IN_INODE():
#define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \ ((offsetof(typeof(*ext4_inode), field) + \ sizeof((ext4_inode)->field)) \ <= (EXT4_GOOD_OLD_INODE_SIZE + \ (einode)->i_extra_isize)) \
be using EXT4_INODE_SIZE() and consulting the superblock instead?
David
Quoted 8 lines · David Howells
Is
EXT4_FITS_IN_INODE()broken? It makes use ofi_extra_isize- which is an optional field and doesn't exist if the filesystem was made with "-I 128".(gdb) p &((struct ext4_inode *)0)->i_extra_isize $2 = (__le16 *) 0x80 <irq_stack_union+128>Should
EXT4_FITS_IN_INODE():
Quoted 7 lines
#define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \ ((offsetof(typeof(*ext4_inode), field) + \ sizeof((ext4_inode)->field)) \ <= (EXT4_GOOD_OLD_INODE_SIZE + \ (einode)->i_extra_isize)) \be using
EXT4_INODE_SIZE()and consulting the superblock instead?
In theory, all the callers should check EXT4_INODE_SIZE() beforehand...
...but that doesn't seem to be happening for the *INODE_[SG]ET_XTIME macros. I think it's time to turn all those macros into proper static inline functions and make them do the size checks rather than hoping we open-code it correctly.
(Also, the XTIME macros themselves are ugly.)
--D
Quoted 6 lines
David
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · David Howells
Is
EXT4_FITS_IN_INODE()broken? It makes use ofi_extra_isize- which is an optional field and doesn't exist if the filesystem was made with "-I 128".(gdb) p &((struct ext4_inode *)0)->i_extra_isize $2 = (__le16 *) 0x80 <irq_stack_union+128>Should
EXT4_FITS_IN_INODE():
Quoted 7 lines
#define EXT4_FITS_IN_INODE(ext4_inode, einode, field) \ ((offsetof(typeof(*ext4_inode), field) + \ sizeof((ext4_inode)->field)) \ <= (EXT4_GOOD_OLD_INODE_SIZE + \ (einode)->i_extra_isize)) \be using
EXT4_INODE_SIZE()and consulting the superblock instead?
Actually, it's not a problem - it's using i_extra_isize from the einode, not the raw inode.
David