[PATCH 1/4][Trivial] lib/kobject.c: Check parameter inkobject_get_path

From: yan
Date: Sat Apr 21 2012 - 05:26:29 EST


kobject_get_path is exported, it passes its parameter kobj to
get_kobj_path_length and fill_kobj_path which are both static
and called only once here. So check this parameter.


Signed-off-by: Yan Hong <clouds.yan@xxxxxxxxx>
---
lib/kobject.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index 38fcc60..56c8cb3 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -104,6 +104,9 @@ char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
char *path;
int len;

+ if (!kobj)
+ return NULL;
+
len = get_kobj_path_length(kobj);
if (len == 0)
return NULL;
--
1.7.5.1



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/