ext3: Return -EINVAL when start is beyond the end of fs in ext3_trim_fs()
authorLukas Czerner <lczerner@redhat.com>
Wed, 22 Jun 2011 08:51:09 +0000 (10:51 +0200)
committerJan Kara <jack@suse.cz>
Sat, 25 Jun 2011 15:29:53 +0000 (17:29 +0200)
We should return -EINVAL when the FITRIM parameters are not sane, but
currently we are exiting silently if start is beyond the end of the
file system. This commit fixes this so we return -EINVAL as other file
systems do.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
CC: Jan Kara <jack@suse.cz>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/ext3/balloc.c

index f7d111e499ad4af94a4f25733cf29bd298a38181..6386d76f44a7d1d9939508e1e8e8be66b394033b 100644 (file)
@@ -2108,7 +2108,7 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
        if (unlikely(minlen > EXT3_BLOCKS_PER_GROUP(sb)))
                return -EINVAL;
        if (start >= max_blks)
-               goto out;
+               return -EINVAL;
        if (start + len > max_blks)
                len = max_blks - start;
 
@@ -2156,8 +2156,6 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
 
        if (ret >= 0)
                ret = 0;
-
-out:
        range->len = trimmed * sb->s_blocksize;
 
        return ret;