[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YAmxrkT81IdsSXe4@mit.edu>
Date: Thu, 21 Jan 2021 11:54:06 -0500
From: "Theodore Ts'o" <tytso@....edu>
To: Harshad Shirwadkar <harshadshirwadkar@...il.com>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH v3 08/15] e2fsck: add fast commit setup code
On Wed, Jan 20, 2021 at 01:26:34PM -0800, Harshad Shirwadkar wrote:
> diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
> index fdcb28f6..eb2e6549 100644
> --- a/lib/ext2fs/ext2fs.h
> +++ b/lib/ext2fs/ext2fs.h
> @@ -2148,4 +2148,7 @@ static inline unsigned int ext2_dir_htree_level(ext2_filsys fs)
> }
> #endif
>
> +/* Commonly used helpers */
> +#define max(a, b) ((a) > (b) ? (a) : (b))
> +
> #endif /* _EXT2FS_EXT2FS_H */
It's better not to add this to a publically exported file, such as
lib/ext2fs/ext2fs.h, since it may conflict with other userspace
application which may define their own max file.
Something which we might want to do is to add something like
linux/minmax.h from the kernel sources to libsupport. This defines a
max() macro which does paranoid typechecking to make sure we don't
accidentally compare an unsigned int to an signed int, which can
potential security problems with maliciously fuzzed file system
images. :-)
- Ted
Powered by blists - more mailing lists