* [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()
@ 2011-09-13 6:06 Jeff Liu
2011-09-14 5:40 ` Li Zefan
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Liu @ 2011-09-13 6:06 UTC (permalink / raw)
To: linux-btrfs
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/btrfs/super.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 15634d4..16f31e1 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char
*options, fmode_t flags,
u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
{
substring_t args[MAX_OPT_ARGS];
- char *opts, *orig, *p;
+ char *device_name, *opts, *orig, *p;
int error = 0;
int intarg;
@@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char
*options, fmode_t flags,
}
break;
case Opt_device:
- error = btrfs_scan_one_device(match_strdup(&args[0]),
+ device_name = match_strdup(&args[0]);
+ if (!device_name) {
+ error = -ENOMEM;
+ goto out_free_opts;
+ }
+ error = btrfs_scan_one_device(device_name,
flags, holder, fs_devices);
+ kfree(device_name);
if (error)
goto out_free_opts;
break;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()
2011-09-13 6:06 [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options() Jeff Liu
@ 2011-09-14 5:40 ` Li Zefan
2011-09-14 6:11 ` Jeff Liu
0 siblings, 1 reply; 6+ messages in thread
From: Li Zefan @ 2011-09-14 5:40 UTC (permalink / raw)
To: jeff.liu; +Cc: linux-btrfs
14:06, Jeff Liu wrote:
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>
> ---
> fs/btrfs/super.c | 10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 15634d4..16f31e1 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
> u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
> {
> substring_t args[MAX_OPT_ARGS];
> - char *opts, *orig, *p;
> + char *device_name, *opts, *orig, *p;
Seems your email client replaced tabs with spaces.
Please read Documentation/email-clients.txt
> int error = 0;
> int intarg;
>
> @@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
> }
> break;
> case Opt_device:
> - error = btrfs_scan_one_device(match_strdup(&args[0]),
> + device_name = match_strdup(&args[0]);
> + if (!device_name) {
> + error = -ENOMEM;
> + goto out_free_opts;
> + }
> + error = btrfs_scan_one_device(device_name,
> flags, holder, fs_devices);
> + kfree(device_name);
> if (error)
> goto out_free_opts;
> break;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()
2011-09-14 5:40 ` Li Zefan
@ 2011-09-14 6:11 ` Jeff Liu
2011-09-15 12:05 ` David Sterba
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Liu @ 2011-09-14 6:11 UTC (permalink / raw)
To: Li Zefan; +Cc: linux-btrfs
On 09/14/2011 01:40 PM, Li Zefan wrote:
> 14:06, Jeff Liu wrote:
>> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>>
>> ---
>> fs/btrfs/super.c | 10 ++++++++--
>> 1 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
>> index 15634d4..16f31e1 100644
>> --- a/fs/btrfs/super.c
>> +++ b/fs/btrfs/super.c
>> @@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
>> u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
>> {
>> substring_t args[MAX_OPT_ARGS];
>> - char *opts, *orig, *p;
>> + char *device_name, *opts, *orig, *p;
>
> Seems your email client replaced tabs with spaces.
Fixed, thank you.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/btrfs/super.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 15634d4..16f31e1 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char
*options, fmode_t flags,
u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
{
substring_t args[MAX_OPT_ARGS];
- char *opts, *orig, *p;
+ char *device_name, *opts, *orig, *p;
int error = 0;
int intarg;
@@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char
*options, fmode_t flags,
}
break;
case Opt_device:
- error = btrfs_scan_one_device(match_strdup(&args[0]),
+ device_name = match_strdup(&args[0]);
+ if (!device_name) {
+ error = -ENOMEM;
+ goto out_free_opts;
+ }
+ error = btrfs_scan_one_device(device_name,
flags, holder, fs_devices);
+ kfree(device_name);
if (error)
goto out_free_opts;
break;
--
1.7.4.1
>
> Please read Documentation/email-clients.txt
>
>> int error = 0;
>> int intarg;
>>
>> @@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
>> }
>> break;
>> case Opt_device:
>> - error = btrfs_scan_one_device(match_strdup(&args[0]),
>> + device_name = match_strdup(&args[0]);
>> + if (!device_name) {
>> + error = -ENOMEM;
>> + goto out_free_opts;
>> + }
>> + error = btrfs_scan_one_device(device_name,
>> flags, holder, fs_devices);
>> + kfree(device_name);
>> if (error)
>> goto out_free_opts;
>> break;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()
2011-09-14 6:11 ` Jeff Liu
@ 2011-09-15 12:05 ` David Sterba
2011-09-15 15:01 ` [PATCH V2] " Jeff Liu
0 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2011-09-15 12:05 UTC (permalink / raw)
To: Jeff Liu; +Cc: Li Zefan, linux-btrfs
On Wed, Sep 14, 2011 at 02:11:21PM +0800, Jeff Liu wrote:
> On 09/14/2011 01:40 PM, Li Zefan wrote:
>
> > 14:06, Jeff Liu wrote:
> >> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> >>
> >> ---
> >> fs/btrfs/super.c | 10 ++++++++--
> >> 1 files changed, 8 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> >> index 15634d4..16f31e1 100644
> >> --- a/fs/btrfs/super.c
> >> +++ b/fs/btrfs/super.c
> >> @@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
> >> u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
> >> {
> >> substring_t args[MAX_OPT_ARGS];
> >> - char *opts, *orig, *p;
> >> + char *device_name, *opts, *orig, *p;
> >
> > Seems your email client replaced tabs with spaces.
>
> Fixed, thank you.
>
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>
> ---
> fs/btrfs/super.c | 10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 15634d4..16f31e1 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char
> *options, fmode_t flags,
^^^^^^^^^^^^^^^^^^^^^^^^
long lines are still getting wrapped.
> u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
> {
> substring_t args[MAX_OPT_ARGS];
> - char *opts, *orig, *p;
> + char *device_name, *opts, *orig, *p;
> int error = 0;
> int intarg;
>
> @@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char
> *options, fmode_t flags,
^^^^^^^^^^^^^^^^^^^^^^^^
> }
> break;
> case Opt_device:
> - error = btrfs_scan_one_device(match_strdup(&args[0]),
> + device_name = match_strdup(&args[0]);
> + if (!device_name) {
> + error = -ENOMEM;
> + goto out_free_opts;
> + }
> + error = btrfs_scan_one_device(device_name,
> flags, holder, fs_devices);
> + kfree(device_name);
> if (error)
> goto out_free_opts;
> break;
> --
> 1.7.4.1
and you do not need to keep unrelated replies and signatures (like the
following quoted text). Just send the patch again with proper changelog
and add a version tag eg
[PATCH v2] btrfs: ...
It's really annoying to hand fix corrupted patches from mailinglist,
>
>
> >
> > Please read Documentation/email-clients.txt
> >
> >> int error = 0;
> >> int intarg;
> >>
> >> @@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
> >> }
> >> break;
> >> case Opt_device:
> >> - error = btrfs_scan_one_device(match_strdup(&args[0]),
> >> + device_name = match_strdup(&args[0]);
> >> + if (!device_name) {
> >> + error = -ENOMEM;
> >> + goto out_free_opts;
> >> + }
> >> + error = btrfs_scan_one_device(device_name,
> >> flags, holder, fs_devices);
> >> + kfree(device_name);
> >> if (error)
> >> goto out_free_opts;
> >> break;
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()
2011-09-15 12:05 ` David Sterba
@ 2011-09-15 15:01 ` Jeff Liu
2011-09-15 18:07 ` David Sterba
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Liu @ 2011-09-15 15:01 UTC (permalink / raw)
To: linux-btrfs; +Cc: Li Zefan, dave
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/btrfs/super.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 15634d4..16f31e1 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
{
substring_t args[MAX_OPT_ARGS];
- char *opts, *orig, *p;
+ char *device_name, *opts, *orig, *p;
int error = 0;
int intarg;
@@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
}
break;
case Opt_device:
- error = btrfs_scan_one_device(match_strdup(&args[0]),
+ device_name = match_strdup(&args[0]);
+ if (!device_name) {
+ error = -ENOMEM;
+ goto out_free_opts;
+ }
+ error = btrfs_scan_one_device(device_name,
flags, holder, fs_devices);
+ kfree(device_name);
if (error)
goto out_free_opts;
break;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()
2011-09-15 15:01 ` [PATCH V2] " Jeff Liu
@ 2011-09-15 18:07 ` David Sterba
0 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2011-09-15 18:07 UTC (permalink / raw)
To: Jeff Liu; +Cc: linux-btrfs, Li Zefan, dave
On Thu, Sep 15, 2011 at 11:01:28PM +0800, Jeff Liu wrote:
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
>
> ---
> fs/btrfs/super.c | 10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 15634d4..16f31e1 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
> u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
> {
> substring_t args[MAX_OPT_ARGS];
> - char *opts, *orig, *p;
> + char *device_name, *opts, *orig, *p;
> int error = 0;
> int intarg;
>
> @@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
> }
> break;
> case Opt_device:
> - error = btrfs_scan_one_device(match_strdup(&args[0]),
> + device_name = match_strdup(&args[0]);
> + if (!device_name) {
> + error = -ENOMEM;
> + goto out_free_opts;
> + }
> + error = btrfs_scan_one_device(device_name,
> flags, holder, fs_devices);
> + kfree(device_name);
> if (error)
> goto out_free_opts;
> break;
> --
> 1.7.4.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-09-15 18:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-13 6:06 [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options() Jeff Liu
2011-09-14 5:40 ` Li Zefan
2011-09-14 6:11 ` Jeff Liu
2011-09-15 12:05 ` David Sterba
2011-09-15 15:01 ` [PATCH V2] " Jeff Liu
2011-09-15 18:07 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.