mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: fix incorrect parsing with option string
@ 2014-03-17  9:40 Chao Yu
  2014-03-18  0:33 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2014-03-17  9:40 UTC (permalink / raw)
  To: ???; +Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel

Previously 'background_gc={on***,off***}' is being parsed as correct option,
with this patch we cloud fix the trivial bug in mount process.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/f2fs/super.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 057a3ef..6597290 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -258,9 +258,9 @@ static int parse_options(struct super_block *sb, char *options)
 
 			if (!name)
 				return -ENOMEM;
-			if (!strncmp(name, "on", 2))
+			if (!strncmp(name, "on", strlen(name)))
 				set_opt(sbi, BG_GC);
-			else if (!strncmp(name, "off", 3))
+			else if (!strncmp(name, "off", strlen(name)))
 				clear_opt(sbi, BG_GC);
 			else {
 				kfree(name);
-- 
1.7.9.5



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

* Re: [f2fs-dev] [PATCH] f2fs: fix incorrect parsing with option string
  2014-03-17  9:40 [f2fs-dev] [PATCH] f2fs: fix incorrect parsing with option string Chao Yu
@ 2014-03-18  0:33 ` Jaegeuk Kim
  2014-03-18  0:59   ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2014-03-18  0:33 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel

Hi,

2014-03-17 (월), 17:40 +0800, Chao Yu:
> Previously 'background_gc={on***,off***}' is being parsed as correct option,
> with this patch we cloud fix the trivial bug in mount process.
> 
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
>  fs/f2fs/super.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 057a3ef..6597290 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -258,9 +258,9 @@ static int parse_options(struct super_block *sb, char *options)
>  
>  			if (!name)
>  				return -ENOMEM;
> -			if (!strncmp(name, "on", 2))
> +			if (!strncmp(name, "on", strlen(name)))

What about 'background_gc=o'?
Need to check strlen(name) == 2...
Thanks,

>  				set_opt(sbi, BG_GC);
> -			else if (!strncmp(name, "off", 3))
> +			else if (!strncmp(name, "off", strlen(name)))
>  				clear_opt(sbi, BG_GC);
>  			else {
>  				kfree(name);

-- 
Jaegeuk Kim
Samsung


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

* RE: [f2fs-dev] [PATCH] f2fs: fix incorrect parsing with option string
  2014-03-18  0:33 ` Jaegeuk Kim
@ 2014-03-18  0:59   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2014-03-18  0:59 UTC (permalink / raw)
  To: jaegeuk.kim; +Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel

Hi,

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk.kim@samsung.com]
> Sent: Tuesday, March 18, 2014 8:33 AM
> To: Chao Yu
> Cc: linux-f2fs-devel@lists.sourceforge.net; linux-fsdevel@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [f2fs-dev] [PATCH] f2fs: fix incorrect parsing with option string
> 
> Hi,
> 
> 2014-03-17 (월), 17:40 +0800, Chao Yu:
> > Previously 'background_gc={on***,off***}' is being parsed as correct option,
> > with this patch we cloud fix the trivial bug in mount process.
> >
> > Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> > ---
> >  fs/f2fs/super.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > index 057a3ef..6597290 100644
> > --- a/fs/f2fs/super.c
> > +++ b/fs/f2fs/super.c
> > @@ -258,9 +258,9 @@ static int parse_options(struct super_block *sb, char *options)
> >
> >  			if (!name)
> >  				return -ENOMEM;
> > -			if (!strncmp(name, "on", 2))
> > +			if (!strncmp(name, "on", strlen(name)))
> 
> What about 'background_gc=o'?
> Need to check strlen(name) == 2...

Oh, you're right. I will fix it and send v2 patch.
Thanks for your review. :)

> Thanks,
> 
> >  				set_opt(sbi, BG_GC);
> > -			else if (!strncmp(name, "off", 3))
> > +			else if (!strncmp(name, "off", strlen(name)))
> >  				clear_opt(sbi, BG_GC);
> >  			else {
> >  				kfree(name);
> 
> --
> Jaegeuk Kim
> Samsung


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

end of thread, other threads:[~2014-03-18  0:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-17  9:40 [f2fs-dev] [PATCH] f2fs: fix incorrect parsing with option string Chao Yu
2014-03-18  0:33 ` Jaegeuk Kim
2014-03-18  0:59   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome