All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Chen Gang <gang.chen@asianux.com>
Cc: akpm@linux-foundation.org, jack@suse.cz, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] fs/jbd: set pointer = NULL, after kfree it.
Date: Mon, 31 Dec 2012 16:23:12 +0100	[thread overview]
Message-ID: <20121231152312.GF7564@quack.suse.cz> (raw)
In-Reply-To: <50D7C04B.6010109@asianux.com>

On Mon 24-12-12 10:39:07, Chen Gang wrote:
> 
>   set pointer = NULL, after call journal_destroy_revoke_table.
>     in journal_destroy_revoke_table, it will call kfree to free the buffer.
  The journal structure will get freed immediately after we return from
journal_init_revoke() (in case it failed) or journal_destroy_revoke() so I
don't see a point in setting the pointers to NULL. Or do I miss something?

								Honza
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  fs/jbd/revoke.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c
> index 25c713e..d6457b0 100644
> --- a/fs/jbd/revoke.c
> +++ b/fs/jbd/revoke.c
> @@ -295,6 +295,7 @@ int journal_init_revoke(journal_t *journal, int hash_size)
>  
>  fail1:
>  	journal_destroy_revoke_table(journal->j_revoke_table[0]);
> +	journal->j_revoke_table[0] = NULL;
>  fail0:
>  	return -ENOMEM;
>  }
> @@ -303,10 +304,14 @@ fail0:
>  void journal_destroy_revoke(journal_t *journal)
>  {
>  	journal->j_revoke = NULL;
> -	if (journal->j_revoke_table[0])
> +	if (journal->j_revoke_table[0]) {
>  		journal_destroy_revoke_table(journal->j_revoke_table[0]);
> -	if (journal->j_revoke_table[1])
> +		journal->j_revoke_table[0] = NULL;
> +	}
> +	if (journal->j_revoke_table[1]) {
>  		journal_destroy_revoke_table(journal->j_revoke_table[1]);
> +		journal->j_revoke_table[1] = NULL;
> +	}
>  }
>  
>  
> -- 
> 1.7.10.4
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2012-12-31 15:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-24  2:39 [PATCH] fs/jbd: set pointer = NULL, after kfree it Chen Gang
2012-12-31 15:23 ` Jan Kara [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-01-04  1:37 Chen Gang

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=20121231152312.GF7564@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=gang.chen@asianux.com \
    --cc=linux-ext4@vger.kernel.org \
    /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.