Messages in this thread Patch in this message | | | Subject | [PATCH] kobject_add() must have a valid name in order to succeed. | Date | Mon, 6 Feb 2006 12:29:17 -0800 | From | Greg KH <> |
| |
[PATCH] kobject_add() must have a valid name in order to succeed.
So we might as well check to verify this, and let the user know that something is wrong if they didn't do it correctly, instead of oopsing later on in kobject_get_name() or somewhere else.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- commit c171fef5c8566cf5f57877e7832fa696ecdf5228 tree c599efed9172ce2f31835d4df01936063fad3a77 parent e3f749c4af69c4344d89f11e2293e3790eb4eaca author Greg Kroah-Hartman <gregkh@suse.de> Fri, 20 Jan 2006 14:08:59 -0800 committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800
lib/kobject.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/kobject.c b/lib/kobject.c index 7a0e680..fe4ae36 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", - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |