From: Jan Kara <jack@suse.cz>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] udf: remove redundant tests on unsigned
Date: Wed, 24 Jun 2009 13:48:56 +0200 [thread overview]
Message-ID: <20090624114856.GA2303@duck.suse.cz> (raw)
In-Reply-To: <4A3FF3BD.1040702@gmail.com>
On Mon 22-06-09 23:12:29, Roel Kluin wrote:
> first_block and goal are unsigned. When negative they are wrapped and caught by
> the other test.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Thanks for the patch. I've merged it in UDF tree.
Honza
> ---
> diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
> index e48e9a3..1e06853 100644
> --- a/fs/udf/balloc.c
> +++ b/fs/udf/balloc.c
> @@ -238,7 +238,7 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,
>
> mutex_lock(&sbi->s_alloc_mutex);
> part_len = sbi->s_partmaps[partition].s_partition_len;
> - if (first_block < 0 || first_block >= part_len)
> + if (first_block >= part_len)
> goto out;
>
> if (first_block + block_count > part_len)
> @@ -297,7 +297,7 @@ static int udf_bitmap_new_block(struct super_block *sb,
> mutex_lock(&sbi->s_alloc_mutex);
>
> repeat:
> - if (goal < 0 || goal >= sbi->s_partmaps[partition].s_partition_len)
> + if (goal >= sbi->s_partmaps[partition].s_partition_len)
> goal = 0;
>
> nr_groups = bitmap->s_nr_groups;
> @@ -666,8 +666,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
> int8_t etype = -1;
> struct udf_inode_info *iinfo;
>
> - if (first_block < 0 ||
> - first_block >= sbi->s_partmaps[partition].s_partition_len)
> + if (first_block >= sbi->s_partmaps[partition].s_partition_len)
> return 0;
>
> iinfo = UDF_I(table);
> @@ -743,7 +742,7 @@ static int udf_table_new_block(struct super_block *sb,
> return newblock;
>
> mutex_lock(&sbi->s_alloc_mutex);
> - if (goal < 0 || goal >= sbi->s_partmaps[partition].s_partition_len)
> + if (goal >= sbi->s_partmaps[partition].s_partition_len)
> goal = 0;
>
> /* We search for the closest matching block to goal. If we find
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
prev parent reply other threads:[~2009-06-24 11:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 21:12 Roel Kluin
2009-06-24 11:48 ` Jan Kara [this message]
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=20090624114856.GA2303@duck.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/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
all inboxes | Powered by JetHome®