[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48775573.3050203@redhat.com>
Date: Fri, 11 Jul 2008 08:43:31 -0400
From: Peter Staubach <staubach@...hat.com>
To: Manish Katiyar <mkatiyar@...il.com>
CC: linux-ext4@...r.kernel.org, Theodore Tso <tytso@....edu>
Subject: Re: [PATCH] e2fsprogs : Add stricter checks for blocksize in ext2fs_open
Manish Katiyar wrote:
> Below patch adds stricter checks in ext2fs_open() so that we catch bad
> block sizes earlier than later.
>
> ============================================================================
>
> Signed-off-by: "Manish Katiyar" <mkatiyar@...il.com>
>
> ---
> lib/ext2fs/openfs.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
> index fc54afe..670cc7c 100644
> --- a/lib/ext2fs/openfs.c
> +++ b/lib/ext2fs/openfs.c
> @@ -233,7 +233,9 @@ errcode_t ext2fs_open2(const char *name, const
> char *io_options,
> }
>
> fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
> - if (fs->blocksize == 0) {
> + if ((fs->blocksize < EXT2_MIN_BLOCK_SIZE) ||
> + (fs->blocksize > EXT2_MAX_BLOCK_SIZE) ||
> + (fs->blocksize % EXT2_MIN_BLOCK_SIZE != 0)) {
>
It seems to me that this would read more clearly as:
((fs->blocksize % EXT2_MIN_BLOCK_SIZE) != 0)) {
Thanx!
ps
> retval = EXT2_ET_CORRUPT_SUPERBLOCK;
> goto cleanup;
> }
>
--
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