[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151105175941.GC2213@birch.djwong.org>
Date: Thu, 5 Nov 2015 09:59:41 -0800
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-ext4@...r.kernel.org
Subject: Re: Is EXT4_FITS_IN_INODE() broken?
On Thu, Nov 05, 2015 at 05:18:57PM +0000, David Howells wrote:
> 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?
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
>
> David
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists