1 ext4: unsigned int compared against zero
3 From: Colin Ian King <colin.king@canonical.com>
5 There are two cases where u32 variables n and err are being checked
6 for less than zero error values, the checks is always false because
7 the variables are not signed. Fix this by making the variables ints.
9 Addresses-Coverity: ("Unsigned compared against 0")
10 Fixes: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity")
11 Signed-off-by: Colin Ian King <colin.king@canonical.com>
12 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 fs/ext4/block_validity.c | 3 ++-
15 1 file changed, 2 insertions(+), 1 deletion(-)
17 diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
18 index 968f163b5feb..8d03550aaae3 100644
19 --- a/fs/ext4/block_validity.c
20 +++ b/fs/ext4/block_validity.c
21 @@ -142,7 +142,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino)
23 struct ext4_sb_info *sbi = EXT4_SB(sb);
24 struct ext4_map_blocks map;
25 - u32 i = 0, err = 0, num, n;
29 if ((ino < EXT4_ROOT_INO) ||
30 (ino > le32_to_cpu(sbi->s_es->s_inodes_count)))