lkml.org 
[lkml]   [2019]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ext4: Variable to signed to check return code
Date
Variables 'n' and 'err' are both used for less-than-zero error checking,
however both are declared as unsigned. Ensure ext4_map_blocks() and
add_system_zone() are able to have their return values propagated
correctly by redefining them both as signed integers.

../fs/ext4/block_validity.c:158:9: warning: comparison of unsigned
expression < 0 is always false [-Wtype-limits]
if (n < 0) {
^

../fs/ext4/block_validity.c:173:12: warning: comparison of unsigned
expression < 0 is always false [-Wtype-limits]
if (err < 0)
^

Signed-off-by: Philippe Mazenauer <philippe.mazenauer@outlook.de>
---
fs/ext4/block_validity.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 968f163b5feb..678e99aeef1f 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -142,7 +142,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;
+ int err = 0, n;
+ u32 i = 0, num;

if ((ino < EXT4_ROOT_INO) ||
(ino > le32_to_cpu(sbi->s_es->s_inodes_count)))
--
2.17.1
\
 
 \ /
  Last update: 2019-05-17 11:02    [W:0.058 / U:40.968 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site