Skip to contentSkip to conversation

ext3: Return -EINVAL when start is beyond the end of fs in ext3_trim_fs()

PATCH In review Lukas Czerner 2 participants 2 messages Jun 22, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext3: Return -EINVAL when start is beyond the end of fs in ext3_trim_fs()

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.

---
 fs/ext3/balloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ext3/balloc.c +1 -1
index fe52297..790cdf3 100644
@@ -2100,7 +2100,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;
 
Signature · 1 line
1.7.4.4
#1 lore raw
Quoted 4 lines · Lukas Czerner

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.

Thanks. Merged.

Honza

Quoted 23 lines
---
 fs/ext3/balloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ext3/balloc.c +1 -1
index fe52297..790cdf3 100644
@@ -2100,7 +2100,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;
 
Signature · 1 line
1.7.4.4
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR