From ad5429c74ca331087f02f336e6cbc8fabad53043 Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Sun, 2 Mar 2003 21:59:26 -0600 Subject: [PATCH] kobject: fix oops in to_kset() Check whether kset is NULL or not before doing container_of(). From Dominik Brodowski --- include/linux/kobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kobject.h b/include/linux/kobject.h index e93b438b829c5..e9cfa0dc3d249 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -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) -- 2.53.0