lkml.org 
[lkml]   [2005]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] udf: uint32_t can't be less than zero
Here's a patch that removes a few bits from fs/udf/balloc.c that 
test uint32_t values for being less than zero, which is impossible.

I know not everyone agree with this sort of cleanup, but I figured I'd do
the patch in any case, then leave it up to the maintainer to apply it or
drop it.

Please keep me on CC: when replying.



Signed-Off-by: Jesper Juhl <juhl-lkml@dif.dk>


--- linux-2.6.12-rc2-mm3-orig/fs/udf/balloc.c 2005-03-02 08:37:52.000000000 +0100
+++ linux-2.6.12-rc2-mm3/fs/udf/balloc.c 2005-04-23 20:38:31.000000000 +0200
@@ -158,8 +158,7 @@ static void udf_bitmap_free_blocks(struc
unsigned long overflow;

down(&sbi->s_alloc_sem);
- if (bloc.logicalBlockNum < 0 ||
- (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
+ if ((bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
{
udf_debug("%d < %d || %d + %d > %d\n",
bloc.logicalBlockNum, 0, bloc.logicalBlockNum, count,
@@ -232,7 +231,7 @@ static int udf_bitmap_prealloc_blocks(st
struct buffer_head *bh;

down(&sbi->s_alloc_sem);
- if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
+ if (first_block >= UDF_SB_PARTLEN(sb, partition))
goto out;

if (first_block + block_count > UDF_SB_PARTLEN(sb, partition))
@@ -299,7 +298,7 @@ static int udf_bitmap_new_block(struct s
down(&sbi->s_alloc_sem);

repeat:
- if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
+ if (goal >= UDF_SB_PARTLEN(sb, partition))
goal = 0;

nr_groups = bitmap->s_nr_groups;
@@ -439,8 +438,7 @@ static void udf_table_free_blocks(struct
int i;

down(&sbi->s_alloc_sem);
- if (bloc.logicalBlockNum < 0 ||
- (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
+ if ((bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
{
udf_debug("%d < %d || %d + %d > %d\n",
bloc.logicalBlockNum, 0, bloc.logicalBlockNum, count,
@@ -688,7 +686,7 @@ static int udf_table_prealloc_blocks(str
struct buffer_head *bh;
int8_t etype = -1;

- if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
+ if (first_block >= UDF_SB_PARTLEN(sb, partition))
return 0;

if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT)
@@ -768,7 +766,7 @@ static int udf_table_new_block(struct su
return newblock;

down(&sbi->s_alloc_sem);
- if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
+ if (goal >= UDF_SB_PARTLEN(sb, partition))
goal = 0;

/* We search for the closest matching block to goal. If we find a exact hit,



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-04-23 20:49    [W:0.052 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site