btrfs: correctly validate compression type
[linux-2.6-block.git] / fs / btrfs / props.c
index a9e2e66152eef7d701eb483cb43f5df56fe8c610..af109c0ba72075f6561a50132f1046a5d22d5c68 100644 (file)
@@ -257,11 +257,7 @@ static int prop_compression_validate(const char *value, size_t len)
        if (!value)
                return 0;
 
-       if (!strncmp("lzo", value, 3))
-               return 0;
-       else if (!strncmp("zlib", value, 4))
-               return 0;
-       else if (!strncmp("zstd", value, 4))
+       if (btrfs_compress_is_valid_type(value, len))
                return 0;
 
        return -EINVAL;