diff options
author | Lokesh Vutla <lokeshvutla@ti.com> | 2017-04-26 16:58:22 +0530 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-04-27 16:49:09 -0400 |
commit | 509b498a500afab1111d69f789b630c699b071a3 (patch) | |
tree | 9dc40469845fd01d98382361f89be57f855a5859 /fs/ext4/ext4fs.c | |
parent | 8a707bafe0677b034632dda6dd0dc1061b105ff1 (diff) |
ext4: Fix comparision of unsigned expression with < 0
In file ext4fs.c funtion ext4fs_read_file() compares an
unsigned expression with < 0 like below
lbaint_t blknr;
blknr = read_allocated_block(&(node->inode), i);
if (blknr < 0)
return -1;
blknr is of type ulong/uint64_t. read_allocated_block() returns
long int. So comparing blknr with < 0 will always be false. Instead
declare blknr as long int.
Similarly ext4/dev.c does a similar comparison. Drop the redundant
comparison.
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'fs/ext4/ext4fs.c')
-rw-r--r-- | fs/ext4/ext4fs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index 7187dcfb056..081509dbb4d 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -71,7 +71,7 @@ int ext4fs_read_file(struct ext2fs_node *node, loff_t pos, blockcnt = lldiv(((len + pos) + blocksize - 1), blocksize); for (i = lldiv(pos, blocksize); i < blockcnt; i++) { - lbaint_t blknr; + long int blknr; int blockoff = pos - (blocksize * i); int blockend = blocksize; int skipfirst = 0; |