Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


arend at broadcom

May 23, 2012, 6:13 AM

Post #1 of 2 (31 views)
Permalink
[PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions

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 [at] broadcom>
---
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


gregkh at linuxfoundation

May 23, 2012, 6:29 AM

Post #2 of 2 (27 views)
Permalink
Re: [PATCH for-3.6] debugfs: change parameter check in debugfs_remove() functions [In reply to]

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 [at] broadcom>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.