Re: [PATCH v2] ext2: fix datatype of block number in ext2_xattr_set2()

From: Jan Kara
Date: Wed Aug 16 2023 - 10:17:40 EST


On Wed 16-08-23 07:31:34, Georg Ottinger wrote:
> I missed the proper format string for the debug message.

Thanks. I've fixed up the patch in my tree.

> answering Andreas question - I did check the remaining calls to
> ext2_new_block(), ext2_new_blocks() and ext2_free_blocks() within the
> ext2 directory - here the block argument is either unsigned long or
> ext2_fsblk_t (which is a typedef to unsigend long) - However I want to
> mention that the use of unsigned long / ext2_fsblk_t is inconsistent. I
> guess that ext2_fsblk_t should be the prefered data type.

Yes, that's correct. We should be using ext2_fsblk_t all over the place. In
fact unsigned long is also a questionable type. On disk the block number is
u32, so unsigned long is pointlessly big on 64-bit archs and just using u32
as ext2_fsblk_t would make more sense. But then it's possible there are
some overflows in the code currently hidden by the fact that most of the
testing happens on 64-bit where long is 64-bit. So the switch would need
somewhat careful review.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR