mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: prasad <prasadjoshi.linux@gmail.com>
To: "Wei Yongjun" <weiyj.lk@gmail.com>,
	=?ISO-8859-1?Q?=20=22=1B@prasadjoshi.l?=.=?ISO-8859-1?Q?inux=22
Cc: joern@logfs.org, yongjun_wei@trendmicro.com.cn,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: fix possible memory leak in logfs_mtd_can_write_buf()
Date: Mon, 3 Sep 2012 09:23:22 +0530	[thread overview]
Message-ID: <504429b8.65d9440a.6f1d.33d2@mx.google.com> (raw)
In-Reply-To: <CAPgLHd-Qcfx2XSo_Ykq55yojTg3aCx_uvyxFA+YfKQaURwPUbg@mail.gmail.com>

On Sun, Sep 02, 2012 at 10:19:06PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> buf has been allocated in this function and should be
> freed before leaving from the error handling case.
> 
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---

Applied, Thanks!

>  fs/logfs/dev_mtd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
> index 9c50144..427bb73 100644
> --- a/fs/logfs/dev_mtd.c
> +++ b/fs/logfs/dev_mtd.c
> @@ -245,8 +245,8 @@ static int logfs_mtd_can_write_buf(struct super_block *sb, u64 ofs)
>  		goto out;
>  	if (memchr_inv(buf, 0xff, super->s_writesize))
>  		err = -EIO;
> -	kfree(buf);
>  out:
> +	kfree(buf);
>  	return err;
>  }
>  
> 
> 

      reply	other threads:[~2012-09-03  3:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-02 14:19 Wei Yongjun
2012-09-03  3:53 ` prasad [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=504429b8.65d9440a.6f1d.33d2@mx.google.com \
    --to=prasadjoshi.linux@gmail.com \
    --cc==?ISO-8859-1?Q?=20=22=1B@prasadjoshi.l?=.=?ISO-8859-1?Q?inux=22 \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=weiyj.lk@gmail.com \
    --cc=yongjun_wei@trendmicro.com.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®