lkml.org 
[lkml]   [2012]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 1/4][Trivial] lib/kobject.c: Check parameter in kobject_get_path
From
Date
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@gmail.com>
---
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




\
 
 \ /
  Last update: 2012-04-21 11:29    [W:0.031 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site