diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 3e452525f8ad..083f9c485875 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -1111,8 +1111,9 @@ unsigned int btrfs_compress_str2level(const char *str) if (strncmp(str, "zlib", 4) != 0) return 0; - if ('1' <= str[4] && str[4] <= '9' ) - return str[4] - '0'; + /* Accepted form: zlib:1 up to zlib:9 and nothing left after the number */ + if (str[4] == ':' && '1' <= str[5] && str[5] <= '9' && str[6] == 0) + return str[5] - '0'; return 0; } diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 57f3f9600e18..65af029559b5 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1261,7 +1261,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) else seq_printf(seq, ",compress=%s", compress_type); if (info->compress_level) - seq_printf(seq, "%d", info->compress_level); + seq_printf(seq, ":%d", info->compress_level); } if (btrfs_test_opt(info, NOSSD)) seq_puts(seq, ",nossd");