Commit cdcc3f24 authored by Colin Ian King's avatar Colin Ian King Committed by Kleber Sacilotto de Souza

ext4: unsigned int compared against zero

BugLink: https://bugs.launchpad.net/bugs/1878098

commit fbbbbd2f upstream.

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: 345c0dbf ("ext4: protect journal inode's blocks using block_validity")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarAshwin H <ashwinh@vmware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 82c35669
...@@ -141,7 +141,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) ...@@ -141,7 +141,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino)
struct inode *inode; struct inode *inode;
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_map_blocks map; struct ext4_map_blocks map;
u32 i = 0, err = 0, num, n; u32 i = 0, num;
int err = 0, n;
if ((ino < EXT4_ROOT_INO) || if ((ino < EXT4_ROOT_INO) ||
(ino > le32_to_cpu(sbi->s_es->s_inodes_count))) (ino > le32_to_cpu(sbi->s_es->s_inodes_count)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment