public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Staubach <staubach@redhat.com>
To: Manish Katiyar <mkatiyar@gmail.com>
Cc: linux-ext4@vger.kernel.org, Theodore Tso <tytso@mit.edu>
Subject: Re: [PATCH] e2fsprogs : Add stricter checks for blocksize in ext2fs_open
Date: Fri, 11 Jul 2008 08:43:31 -0400	[thread overview]
Message-ID: <48775573.3050203@redhat.com> (raw)
In-Reply-To: <ea11fea30807110149g31065f31k5231bbebc5133587@mail.gmail.com>

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@gmail.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;
>  	}
>   


  reply	other threads:[~2008-07-11 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-11  8:49 [PATCH] e2fsprogs : Add stricter checks for blocksize in ext2fs_open Manish Katiyar
2008-07-11 12:43 ` Peter Staubach [this message]
2008-07-11 12:55 ` Theodore Tso
2008-07-11 21:46   ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48775573.3050203@redhat.com \
    --to=staubach@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mkatiyar@gmail.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox