public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4][Trivial] lib/kobject.c : Check parameter in kobject_set_name
@ 2012-04-21  9:31 yan
  2012-04-23 20:39 ` greg
  0 siblings, 1 reply; 2+ messages in thread
From: yan @ 2012-04-21  9:31 UTC (permalink / raw)
  To: greg; +Cc: kernel, message

kobject_set_name is exported and is just a wrapper for kobject_set_name_vargs
which does not check its parameter kobj. 
So check this parameter in kobject_set_name.


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 56c8cb3..dd67855 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -248,6 +248,9 @@ int kobject_set_name(struct kobject *kobj, const char *fmt, ...)
 	va_list vargs;
 	int retval;
 
+	if (!kobj)
+		return -EINVAL;
+
 	va_start(vargs, fmt);
 	retval = kobject_set_name_vargs(kobj, fmt, vargs);
 	va_end(vargs);
-- 
1.7.5.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-23 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-21  9:31 [PATCH 2/4][Trivial] lib/kobject.c : Check parameter in kobject_set_name yan
2012-04-23 20:39 ` greg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox