[PATCH 4/7] staging: erofs: return -EINVAL when specifying fault rate to 0

Chengguang Xu cgxu519 at gmx.com
Wed Sep 12 15:10:31 AEST 2018


Set fault rate to 0 is useless and confusable, so add check to
avoid it.

Signed-off-by: Chengguang Xu <cgxu519 at gmx.com>
---
 drivers/staging/erofs/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index d2dbc1fd3abb..8df680aee55a 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -166,6 +166,8 @@ static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
 
 	if (args->from && match_int(args, &rate))
 		return -EINVAL;
+	if (!rate)
+		return -EINVAL;
 
 	__erofs_build_fault_attr(sbi, rate);
 	return 0;
-- 
2.17.1



More information about the Linux-erofs mailing list