Skip to contentSkip to conversation

f2fs: check inject_rate validity during configuring

PATCH New Chao Yu 1 participant 1 message Jan 4, 2019 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 f2fs: check inject_rate validity during configuring

Type of inject_rate is unsigned int, let's check new value's validity during configuring.

---
 fs/f2fs/sysfs.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/sysfs.c +2 -0
index 0575edbe3ed6..02d4012a9183 100644
@@ -222,6 +222,8 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
 #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);
Signature · 1 line
2.18.0.rc1