All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Jens Axboe <jens.axboe@oracle.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] blktrace: pass the right pointer to kfree()
Date: Thu, 9 Apr 2009 10:13:10 -0300	[thread overview]
Message-ID: <20090409131310.GC24946@ghostprotocols.net> (raw)
In-Reply-To: <49DD694C.8020902@cn.fujitsu.com>

Em Thu, Apr 09, 2009 at 11:19:40AM +0800, Li Zefan escreveu:
> If passing a string with leading white spaces to strstrip(),
> the returned ptr != the original ptr.
> 
> This bug was introduced by me.
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>

I hadn't noticed that strstrip was added, oops.

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

> ---
>  kernel/trace/blktrace.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index b32ff44..921ef5d 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -1377,12 +1377,12 @@ static int blk_trace_str2mask(const char *str)
>  {
>  	int i;
>  	int mask = 0;
> -	char *s, *token;
> +	char *buf, *s, *token;
>  
> -	s = kstrdup(str, GFP_KERNEL);
> -	if (s == NULL)
> +	buf = kstrdup(str, GFP_KERNEL);
> +	if (buf == NULL)
>  		return -ENOMEM;
> -	s = strstrip(s);
> +	s = strstrip(buf);
>  
>  	while (1) {
>  		token = strsep(&s, ",");
> @@ -1403,7 +1403,7 @@ static int blk_trace_str2mask(const char *str)
>  			break;
>  		}
>  	}
> -	kfree(s);
> +	kfree(buf);
>  
>  	return mask;
>  }
> -- 
> 1.5.4.rc3

      parent reply	other threads:[~2009-04-09 13:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09  3:19 [PATCH] blktrace: pass the right pointer to kfree() Li Zefan
2009-04-09  4:36 ` [tip:tracing/urgent] " Li Zefan
2009-04-09 13:13 ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090409131310.GC24946@ghostprotocols.net \
    --to=acme@redhat.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.