Messages in this thread | | | Date | Mon, 23 Apr 2012 13:38:24 -0700 | From | greg <> | Subject | Re: [PATCH 1/4][Trivial] lib/kobject.c: Check parameter in kobject_get_path |
| |
On Sat, Apr 21, 2012 at 05:25:42PM +0800, yan wrote: > kobject_get_path is exported, it passes its parameter kobj to > get_kobj_path_length and fill_kobj_path which are both static > and called only once here. So check this parameter.
Why? If you call this function, you should pass in a valid pointer, that's the proper way to call it. No need to be "defensive" here at all, if the caller messes up, then it crashes, as it should not be making this type of call on a NULL pointer.
In looking at all of the in-kernel users of this function, they all do this properly, so I see no need for this patch.
And these types of patches are not "trivial" at all, so please don't mark them as such.
thanks,
greg k-h
| |