From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: xfs-masters@oss.sgi.com, xfs@oss.sgi.com, nathans@sgi.com,
Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] XFS: remove pointless conditional testing 'nmp' vs NULL in fs/xfs/xfs_rtalloc.c::xfs_growfs_rt()
Date: Sun, 13 Aug 2006 00:16:50 +0200 [thread overview]
Message-ID: <200608130016.51136.jesper.juhl@gmail.com> (raw)
In fs/xfs/xfs_rtalloc.c::xfs_growfs_rt() there's a completely useless
conditional at the error_exit label.
The 'if (nmp)' check is pointless and might as well be removed for two
reasons.
1) if 'nmp' is NULL then kmem_free() will end up calling kfree() with a NULL
argument - which in turn will just cause a return from kfree(). No harm
done.
2) At the beginning of the function there's an assignment; '*nmp = *mp;' so
if 'nmp' was NULL we'd already have blown up due to dereferencing a NULL
pointer.
This patch gets rid of the pointless check.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
fs/xfs/xfs_rtalloc.c | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
--- linux-2.6.18-rc4-orig/fs/xfs/xfs_rtalloc.c 2006-08-11 00:11:13.000000000 +0200
+++ linux-2.6.18-rc4/fs/xfs/xfs_rtalloc.c 2006-08-13 00:07:43.000000000 +0200
@@ -2107,8 +2107,7 @@ xfs_growfs_rt(
* Error paths come here.
*/
error_exit:
- if (nmp)
- kmem_free(nmp, sizeof(*nmp));
+ kmem_free(nmp, sizeof(*nmp));
xfs_trans_cancel(tp, cancelflags);
return error;
}
next reply other threads:[~2006-08-12 22:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-12 22:16 Jesper Juhl [this message]
2006-08-14 1:09 ` [PATCH] XFS: remove pointless conditional testing 'nmp' vs NULL in fs/xfs/xfs_rtalloc.c::xfs_growfs_rt() Nathan Scott
2006-08-14 7:25 ` Jesper Juhl
2006-08-16 20:44 ` Jesper Juhl
2006-08-17 6:31 ` Nathan Scott
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=200608130016.51136.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nathans@sgi.com \
--cc=xfs-masters@oss.sgi.com \
--cc=xfs@oss.sgi.com \
/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