ext4: fix test ext_generic_write_end() copied return value
authorRoel Kluin <12o3l@tiscali.nl>
Wed, 30 Apr 2008 02:01:18 +0000 (22:01 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 30 Apr 2008 02:01:18 +0000 (22:01 -0400)
'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>
fs/ext4/inode.c

index 0c94db462c2fde4a838dcbb8480fb1474e27617f..8d9707746413d90bc5bf019ea6e2dacad91842c2 100644 (file)
@@ -1311,10 +1311,11 @@ static int ext4_ordered_write_end(struct file *file,
                new_i_size = pos + copied;
                if (new_i_size > EXT4_I(inode)->i_disksize)
                        EXT4_I(inode)->i_disksize = new_i_size;
-               copied = ext4_generic_write_end(file, mapping, pos, len, copied,
+               ret2 = ext4_generic_write_end(file, mapping, pos, len, copied,
                                                        page, fsdata);
-               if (copied < 0)
-                       ret = copied;
+               copied = ret2;
+               if (ret2 < 0)
+                       ret = ret2;
        }
        ret2 = ext4_journal_stop(handle);
        if (!ret)
@@ -1339,10 +1340,11 @@ static int ext4_writeback_write_end(struct file *file,
        if (new_i_size > EXT4_I(inode)->i_disksize)
                EXT4_I(inode)->i_disksize = new_i_size;
 
-       copied = ext4_generic_write_end(file, mapping, pos, len, copied,
+       ret2 = ext4_generic_write_end(file, mapping, pos, len, copied,
                                                        page, fsdata);
-       if (copied < 0)
-               ret = copied;
+       copied = ret2;
+       if (ret2 < 0)
+               ret = ret2;
 
        ret2 = ext4_journal_stop(handle);
        if (!ret)