Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d52e135 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: don't allow negative ->write_io_size_bits



As Dan reported:

"We put an upper bound on ->write_io_size_bits but we don't have a lower
bound."

So let's add lower bound check for ->write_io_size_bits in parse_options().

[We don't allow configuring ->write_io_size_bits to zero, since at least
we need to fill one dummy page for aligned IO.]

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 500e0b28
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -586,7 +586,7 @@ static int parse_options(struct super_block *sb, char *options)
		case Opt_io_size_bits:
		case Opt_io_size_bits:
			if (args->from && match_int(args, &arg))
			if (args->from && match_int(args, &arg))
				return -EINVAL;
				return -EINVAL;
			if (arg > __ilog2_u32(BIO_MAX_PAGES)) {
			if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
				f2fs_msg(sb, KERN_WARNING,
				f2fs_msg(sb, KERN_WARNING,
					"Not support %d, larger than %d",
					"Not support %d, larger than %d",
					1 << arg, BIO_MAX_PAGES);
					1 << arg, BIO_MAX_PAGES);