From: Andrew Morton <akpm@linux-foundation.org>
To: Tim Gardner <tim.gardner@canonical.com>
Cc: linux-kernel@vger.kernel.org, Mark Fasheh <mfasheh@suse.com>,
Joel Becker <jlbec@evilplan.org>,
Akinobu Mita <akinobu.mita@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Tejun Heo <tj@kernel.org>, Jiri Kosina <jkosina@suse.cz>,
ocfs2-devel@oss.oracle.com
Subject: Re: [PATCH linux-next v2] ocfs2: remove kfree() redundant null checks
Date: Wed, 13 Feb 2013 15:53:25 -0800 [thread overview]
Message-ID: <20130213155325.9f352cbf.akpm@linux-foundation.org> (raw)
In-Reply-To: <1360787385-75824-1-git-send-email-tim.gardner@canonical.com>
On Wed, 13 Feb 2013 13:29:45 -0700
Tim Gardner <tim.gardner@canonical.com> wrote:
> smatch analysis indicates a number of redundant NULL checks before
> calling kfree(), e.g.,
>
> fs/ocfs2/alloc.c:6138 ocfs2_begin_truncate_log_recovery() info:
> redundant null check on *tl_copy calling kfree()
>
> fs/ocfs2/alloc.c:6755 ocfs2_zero_range_for_truncate() info:
> redundant null check on pages calling kfree()
>
> ...
>
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index 31b9463..83a1a1d 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -6134,7 +6134,7 @@ bail:
> iput(tl_inode);
> brelse(tl_bh);
>
> - if (status < 0 && (*tl_copy)) {
> + if (status < 0) {
> kfree(*tl_copy);
> *tl_copy = NULL;
> mlog_errno(status);
This change does other things. For example, if
ocfs2_begin_truncate_log_recovery()'s first "goto bail" is taken, we
will now call mlog_errno(status) twice.
That function is pretty confused about its error recovery and logging.
it needs some maintenance. I'll omit this hunk of your patch.
> @@ -534,7 +533,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
> mlog_errno(status);
>
> bail:
> - if ((status < 0) && (*alloc_copy)) {
> + if (status < 0) {
> kfree(*alloc_copy);
> *alloc_copy = NULL;
> }
Similar, but this change lokos OK.
prev parent reply other threads:[~2013-02-13 23:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 20:29 [PATCH linux-next v2] ocfs2: remove kfree() redundant null checks Tim Gardner
2013-02-13 23:53 ` Andrew Morton [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=20130213155325.9f352cbf.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=akinobu.mita@gmail.com \
--cc=davem@davemloft.net \
--cc=jkosina@suse.cz \
--cc=jlbec@evilplan.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=tim.gardner@canonical.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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