Skip to content

Commit fbbbbd2

Browse files
Colin Ian Kingtytso
authored andcommitted
ext4: unsigned int compared against zero
There are two cases where u32 variables n and err are being checked for less than zero error values, the checks is always false because the variables are not signed. Fix this by making the variables ints. Addresses-Coverity: ("Unsigned compared against 0") Fixes: 345c0db ("ext4: protect journal inode's blocks using block_validity") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 08fc98a commit fbbbbd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ext4/block_validity.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino)
142142
struct inode *inode;
143143
struct ext4_sb_info *sbi = EXT4_SB(sb);
144144
struct ext4_map_blocks map;
145-
u32 i = 0, err = 0, num, n;
145+
u32 i = 0, num;
146+
int err = 0, n;
146147

147148
if ((ino < EXT4_ROOT_INO) ||
148149
(ino > le32_to_cpu(sbi->s_es->s_inodes_count)))

0 commit comments

Comments
 (0)