* [PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions
@ 2012-05-23 13:13 Arend van Spriel
2012-05-23 13:29 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Arend van Spriel @ 2012-05-23 13:13 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Arend van Spriel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions
2012-05-23 13:13 [PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions Arend van Spriel
@ 2012-05-23 13:29 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2012-05-23 13:29 UTC (permalink / raw)
To: Arend van Spriel; +Cc: linux-kernel
On Wed, May 23, 2012 at 03:13:07PM +0200, Arend van Spriel wrote:
> 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.
Yes, nice change, thanks.
I'll queue it up after 3.5-rc1 is out.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-23 13:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-23 13:13 [PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions Arend van Spriel
2012-05-23 13:29 ` Greg Kroah-Hartman
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.