Skip to contentSkip to conversation

f2fs: don't allow negative ->write_io_size_bits

PATCH In review Dan Carpenter 3 participants 5 messages Feb 11, 2019 – Feb 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: don't allow negative ->write_io_size_bits

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

---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
index 3ec11d392a5e..2db2d38e2aca 100644
@@ -586,7 +586,7 @@ static int parse_options(struct super_block *sb, char *options)
 		case Opt_io_size_bits:
 			if (args->from && match_int(args, &arg))
 				return -EINVAL;
-			if (arg > __ilog2_u32(BIO_MAX_PAGES)) {
+			if (arg < 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
 				f2fs_msg(sb, KERN_WARNING,
 					"Not support %d, larger than %d",
 					1 << arg, BIO_MAX_PAGES);
Signature · 1 line
2.17.1
#2 lore raw
Quoted 6 lines · Chao Yu
Quoted 2 lines · Dan Carpenter

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

Oh, lower bound, I think there are more cases didn't consider that, let me check it.

Sorry, one missing case:

Shouldn't it be:

if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
         ^
Quoted 16 lines
Quoted 3 lines

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#3 lore raw
Quoted 8 lines · Chao Yu
Quoted 6 lines · Chao Yu
Quoted 2 lines · Dan Carpenter

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

Oh, lower bound, I think there are more cases didn't consider that, let me check it.

Quoted 6 lines

Sorry, one missing case:

Shouldn't it be:

if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
         ^

It wouldn't be hard for me to redo my patch, but I don't know enough to say if zero is invalid and I don't want to get blamed for that... Can you do it, since you're better able to test the change?

So let's drop this patch, and then could you give me Reported-by credit instead?

regards,
dan carpenter

maintainer
#4 lore raw
Quoted 16 lines · Dan Carpenter
Quoted 8 lines · Chao Yu
Quoted 6 lines · Chao Yu
Quoted 2 lines · Dan Carpenter

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

Oh, lower bound, I think there are more cases didn't consider that, let me check it.

Quoted 6 lines

Sorry, one missing case:

Shouldn't it be:

if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
         ^
Quoted 6 lines

It wouldn't be hard for me to redo my patch, but I don't know enough to say if zero is invalid and I don't want to get blamed for that... Can you do it, since you're better able to test the change?

So let's drop this patch, and then could you give me Reported-by credit instead?

No problem. :)

Thanks,

Quoted 11 lines

regards,
dan carpenter

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel