From: "Arend van Spriel" <arend@broadcom.com>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, "Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions
Date: Wed, 23 May 2012 15:13:07 +0200 [thread overview]
Message-ID: <1337778788-7069-1-git-send-email-arend@broadcom.com> (raw)
The dentry parameter in debugfs_remove() and debugfs_remove_recursive()
is checked being a NULL pointer. To make cleanup by callers easier this
check is extended using the IS_ERR_OR_NULL macro instead because the
debugfs_create_... functions can return a ERR_PTR() value.
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
I was adding the check in driver code before calling the recursive remove,
but considered it might be a better idea to do it in debugfs itself.
No rush so I target to include it in v3.6. The patch is based on v3.4 tag.
Gr. AvS
---
fs/debugfs/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index b80bc84..0de5e26 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -498,7 +498,7 @@ void debugfs_remove(struct dentry *dentry)
struct dentry *parent;
int ret;
- if (!dentry)
+ if (IS_ERR_OR_NULL(dentry))
return;
parent = dentry->d_parent;
@@ -530,7 +530,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
struct dentry *child;
struct dentry *parent;
- if (!dentry)
+ if (IS_ERR_OR_NULL(dentry))
return;
parent = dentry->d_parent;
--
1.7.9.5
next reply other threads:[~2012-05-23 13:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 13:13 Arend van Spriel [this message]
2012-05-23 13:29 ` [PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions Greg Kroah-Hartman
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=1337778788-7069-1-git-send-email-arend@broadcom.com \
--to=arend@broadcom.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox