diff options
author | Colin Ian King <colin.king@canonical.com> | 2019-05-11 05:06:38 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-02 18:23:19 +0300 |
commit | 5a905c2d2cf2b11676d1c5e9a0a035c1369ae9df (patch) | |
tree | 8dc6e781884b8abbba4cf6aeba1eb622b5b3b2ba | |
parent | 12140f9b8f5aa316b2888b2c876d3b59a7dac524 (diff) | |
download | linux-5a905c2d2cf2b11676d1c5e9a0a035c1369ae9df.tar.xz |
ext4: unsigned int compared against zero
commit fbbbbd2f28aec991f3fbc248df211550fbdfd58c 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: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ashwin H <ashwinh@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/ext4/block_validity.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 9c9c6394189c..d31d93ee5e76 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c @@ -141,7 +141,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) struct inode *inode; struct ext4_sb_info *sbi = EXT4_SB(sb); 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) || (ino > le32_to_cpu(sbi->s_es->s_inodes_count))) |