lib/kobject.c : Check parameter in kobject_set_name
Subsystems (2)
PATCH 2/4 lib/kobject.c : Check parameter in kobject_set_name
kobject_set_name is exported and is just a wrapper for kobject_set_name_vargs which does not check its parameter kobj.
So check this parameter in kobject_set_name.
Signed-off-by Yan Hong <[email protected]>
--- lib/kobject.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
lib/kobject.c +3 -0
@@ -248,6 +248,9 @@ int kobject_set_name(struct kobject *kobj, const char *fmt, ...)va_list vargs;int retval; +if (!kobj) +return -EINVAL ; +va_start (vargs, fmt); retval =kobject_set_name_vargs (kobj, fmt, vargs);va_end (vargs);
Signature · 1 line
1.7.5.1
greg
maintainerQuoted 3 lines · yan
kobject_set_nameis exported and is just a wrapper forkobject_set_name_vargswhich does not check its parameter kobj.
So check this parameter inkobject_set_name.
I have the same objection to this patch, why is it needed? All in-kernel users do this properly, so the patch isn't needed.
Remember, kernel programming isn't always about being defensive.
greg k-h