linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: don't allow negative ->write_io_size_bits
@ 2019-02-11 18:45 Dan Carpenter
  2019-02-13  3:32 ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2019-02-11 18:45 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: kernel-janitors, linux-f2fs-devel

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 3ec11d392a5e..2db2d38e2aca 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: don't allow negative ->write_io_size_bits
  2019-02-11 18:45 Dan Carpenter
@ 2019-02-13  3:32 ` Chao Yu
  2019-02-13  8:49   ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2019-02-13  3:32 UTC (permalink / raw)
  To: Dan Carpenter, Jaegeuk Kim; +Cc: kernel-janitors, linux-f2fs-devel

On 2019/2/12 2:45, Dan Carpenter wrote:
> 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.

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: don't allow negative ->write_io_size_bits
  2019-02-13  3:32 ` Chao Yu
@ 2019-02-13  8:49   ` Chao Yu
  2019-02-13  9:46     ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2019-02-13  8:49 UTC (permalink / raw)
  To: Dan Carpenter, Jaegeuk Kim; +Cc: kernel-janitors, linux-f2fs-devel

On 2019/2/13 11:32, Chao Yu wrote:
> On 2019/2/12 2:45, Dan Carpenter wrote:
>> 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)) {
         ^
> 
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Reviewed-by: Chao Yu <yuchao0@huawei.com>
> 
> Thanks,
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: don't allow negative ->write_io_size_bits
  2019-02-13  8:49   ` Chao Yu
@ 2019-02-13  9:46     ` Dan Carpenter
  2019-02-14 16:09       ` Chao Yu
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2019-02-13  9:46 UTC (permalink / raw)
  To: Chao Yu; +Cc: Jaegeuk Kim, kernel-janitors, linux-f2fs-devel

On Wed, Feb 13, 2019 at 04:49:57PM +0800, Chao Yu wrote:
> On 2019/2/13 11:32, Chao Yu wrote:
> > On 2019/2/12 2:45, Dan Carpenter wrote:
> >> 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)) {
>          ^

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] f2fs: don't allow negative ->write_io_size_bits
  2019-02-13  9:46     ` Dan Carpenter
@ 2019-02-14 16:09       ` Chao Yu
  0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2019-02-14 16:09 UTC (permalink / raw)
  To: Dan Carpenter, Chao Yu; +Cc: Jaegeuk Kim, kernel-janitors, linux-f2fs-devel

On 2019-2-13 17:46, Dan Carpenter wrote:
> On Wed, Feb 13, 2019 at 04:49:57PM +0800, Chao Yu wrote:
>> On 2019/2/13 11:32, Chao Yu wrote:
>>> On 2019/2/12 2:45, Dan Carpenter wrote:
>>>> 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)) {
>>          ^
> 
> 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,

> 
> regards,
> dan carpenter
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] f2fs: don't allow negative ->write_io_size_bits
@ 2019-02-14 16:16 Chao Yu
  0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2019-02-14 16:16 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu

From: Chao Yu <yuchao0@huawei.com>

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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index be8be445c6ed..230845221c74 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-14 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-14 16:16 [PATCH] f2fs: don't allow negative ->write_io_size_bits Chao Yu
  -- strict thread matches above, loose matches on Subject: below --
2019-02-11 18:45 Dan Carpenter
2019-02-13  3:32 ` Chao Yu
2019-02-13  8:49   ` Chao Yu
2019-02-13  9:46     ` Dan Carpenter
2019-02-14 16:09       ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).