Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3391faa4 authored by Roel Kluin's avatar Roel Kluin Committed by Jan Kara
Browse files

udf: remove redundant tests on unsigned



first_block and goal are unsigned. When negative they are wrapped and caught by
the other test.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 24a5d59f
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -238,7 +238,7 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,


	mutex_lock(&sbi->s_alloc_mutex);
	mutex_lock(&sbi->s_alloc_mutex);
	part_len = sbi->s_partmaps[partition].s_partition_len;
	part_len = sbi->s_partmaps[partition].s_partition_len;
	if (first_block < 0 || first_block >= part_len)
	if (first_block >= part_len)
		goto out;
		goto out;


	if (first_block + block_count > part_len)
	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);
	mutex_lock(&sbi->s_alloc_mutex);


repeat:
repeat:
	if (goal < 0 || goal >= sbi->s_partmaps[partition].s_partition_len)
	if (goal >= sbi->s_partmaps[partition].s_partition_len)
		goal = 0;
		goal = 0;


	nr_groups = bitmap->s_nr_groups;
	nr_groups = bitmap->s_nr_groups;
@@ -666,8 +666,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
	int8_t etype = -1;
	int8_t etype = -1;
	struct udf_inode_info *iinfo;
	struct udf_inode_info *iinfo;


	if (first_block < 0 ||
	if (first_block >= sbi->s_partmaps[partition].s_partition_len)
		first_block >= sbi->s_partmaps[partition].s_partition_len)
		return 0;
		return 0;


	iinfo = UDF_I(table);
	iinfo = UDF_I(table);
@@ -743,7 +742,7 @@ static int udf_table_new_block(struct super_block *sb,
		return newblock;
		return newblock;


	mutex_lock(&sbi->s_alloc_mutex);
	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;
		goal = 0;


	/* We search for the closest matching block to goal. If we find
	/* We search for the closest matching block to goal. If we find