f2fs: check inject_rate validity during configuring
authorChao Yu <yuchao0@huawei.com>
Fri, 4 Jan 2019 09:39:53 +0000 (17:39 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 9 Jan 2019 04:41:09 +0000 (20:41 -0800)
Type of inject_rate is unsigned int, let's check new value's
validity during configuring.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/sysfs.c

index 0575edbe3ed6d23de59ba916c0efd262014b1551..02d4012a918370612a4f0595b6250739469f6990 100644 (file)
@@ -222,6 +222,8 @@ out:
 #ifdef CONFIG_F2FS_FAULT_INJECTION
        if (a->struct_type == FAULT_INFO_TYPE && t >= (1 << FAULT_MAX))
                return -EINVAL;
+       if (a->struct_type == FAULT_INFO_RATE && t >= UINT_MAX)
+               return -EINVAL;
 #endif
        if (a->struct_type == RESERVED_BLOCKS) {
                spin_lock(&sbi->stat_lock);