]> git.baikalelectronics.ru Git - uboot.git/commit
ext4: Fix comparision of unsigned expression with < 0
authorLokesh Vutla <lokeshvutla@ti.com>
Wed, 26 Apr 2017 11:28:22 +0000 (16:58 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 27 Apr 2017 20:49:09 +0000 (16:49 -0400)
commit6ca566358050b118da56b3f77d7978b3ce901e29
tree9dc40469845fd01d98382361f89be57f855a5859
parent31971239b7216f49e1cbcb78711aca13154fed33
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>
fs/ext4/dev.c
fs/ext4/ext4fs.c