lkml.org 
[lkml]   [2013]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface
Date
On Wednesday 09 January 2013, Russell King - ARM Linux wrote:
> d = debugfs_create_dir("pm_debug", NULL);
> if (IS_ERR_OR_NULL(d))
> return PTR_ERR(d);
>
> Well, covered above. NULL is success here.

This one is actually worse, because in case of debugfs_create_dir,
a negative error code is documented to mean "success": The debugfs
functions intentionally return ERR_PTR(-ENODEV) when debugfs is
disabled so that any code checking for NULL pretends it is a valid
pointer, but that code is only allowed to pass this pointer into
other debugfs functions that are also stubbed out and never
dereference it.

Arnd


\
 
 \ /
  Last update: 2013-01-09 13:41    [W:0.137 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site