]> git.hungrycats.org Git - linux/commitdiff
kobject: fix oops in to_kset()
authorPatrick Mochel <mochel@osdl.org>
Mon, 3 Mar 2003 03:59:26 +0000 (21:59 -0600)
committerPatrick Mochel <mochel@osdl.org>
Mon, 3 Mar 2003 03:59:26 +0000 (21:59 -0600)
Check whether kset is NULL or not before doing container_of().

From Dominik Brodowski

include/linux/kobject.h

index e93b438b829c505ef2a6b67adf18ecbf950d47f8..e9cfa0dc3d2494ef48765691eff803e5833264db 100644 (file)
@@ -73,7 +73,7 @@ extern void kset_unregister(struct kset * k);
 
 static inline struct kset * to_kset(struct kobject * kobj)
 {
-       return container_of(kobj,struct kset,kobj);
+       return kobj ? container_of(kobj,struct kset,kobj) : NULL;
 }
 
 static inline struct kset * kset_get(struct kset * k)