diff --git a/lib/kobject.c b/lib/kobject.c index 7a0e6809490d4e17e3d461426371871acefdf4e2..fe4ae36ce9604a192fe3816237c510d4ecd6075d 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -162,6 +162,11 @@ int kobject_add(struct kobject * kobj) return -ENOENT; if (!kobj->k_name) kobj->k_name = kobj->name; + if (!kobj->k_name) { + pr_debug("kobject attempted to be registered with no name!\n"); + WARN_ON(1); + return -EINVAL; + } parent = kobject_get(kobj->parent); pr_debug("kobject %s: registering. parent: %s, set: %s\n",