Commit f8a87d89304c1eea8e4a8dc02d134f57590913c6
Committed by
Theodore Ts'o
1 parent
7c2f3d6f89
Exists in
master
and in
7 other branches
ext4: fix test ext_generic_write_end() copied return value
'copied' is unsigned, whereas 'ret2' is not. The test (copied < 0) fails Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Showing 1 changed file with 8 additions and 6 deletions Side-by-side Diff
fs/ext4/inode.c
... | ... | @@ -1311,10 +1311,11 @@ |
1311 | 1311 | new_i_size = pos + copied; |
1312 | 1312 | if (new_i_size > EXT4_I(inode)->i_disksize) |
1313 | 1313 | EXT4_I(inode)->i_disksize = new_i_size; |
1314 | - copied = ext4_generic_write_end(file, mapping, pos, len, copied, | |
1314 | + ret2 = ext4_generic_write_end(file, mapping, pos, len, copied, | |
1315 | 1315 | page, fsdata); |
1316 | - if (copied < 0) | |
1317 | - ret = copied; | |
1316 | + copied = ret2; | |
1317 | + if (ret2 < 0) | |
1318 | + ret = ret2; | |
1318 | 1319 | } |
1319 | 1320 | ret2 = ext4_journal_stop(handle); |
1320 | 1321 | if (!ret) |
1321 | 1322 | |
... | ... | @@ -1339,10 +1340,11 @@ |
1339 | 1340 | if (new_i_size > EXT4_I(inode)->i_disksize) |
1340 | 1341 | EXT4_I(inode)->i_disksize = new_i_size; |
1341 | 1342 | |
1342 | - copied = ext4_generic_write_end(file, mapping, pos, len, copied, | |
1343 | + ret2 = ext4_generic_write_end(file, mapping, pos, len, copied, | |
1343 | 1344 | page, fsdata); |
1344 | - if (copied < 0) | |
1345 | - ret = copied; | |
1345 | + copied = ret2; | |
1346 | + if (ret2 < 0) | |
1347 | + ret = ret2; | |
1346 | 1348 | |
1347 | 1349 | ret2 = ext4_journal_stop(handle); |
1348 | 1350 | if (!ret) |