public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] driver core: don't pass cls->name as format string in sysdev_class_register()
@ 2008-12-13 10:34 tom.leiming
  2008-12-13 18:16 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: tom.leiming @ 2008-12-13 10:34 UTC (permalink / raw)
  To: kay.sievers, greg; +Cc: linux-kernel, Ming Lei

From: Ming Lei <tom.leiming@gmail.com>

If cls->name contains substring which can be interpreted as
format,maybe it causes oops, so fix it.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/base/sys.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index c98c31e..736ecf7 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -137,7 +137,7 @@ int sysdev_class_register(struct sysdev_class * cls)
 	cls->kset.kobj.parent = &system_kset->kobj;
 	cls->kset.kobj.ktype = &ktype_sysdev_class;
 	cls->kset.kobj.kset = system_kset;
-	kobject_set_name(&cls->kset.kobj, cls->name);
+	kobject_set_name(&cls->kset.kobj, "%s", cls->name);
 	return kset_register(&cls->kset);
 }
 
-- 
1.6.0


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

* Re: [PATCH] driver core: don't pass cls->name as format string in sysdev_class_register()
  2008-12-13 10:34 [PATCH] driver core: don't pass cls->name as format string in sysdev_class_register() tom.leiming
@ 2008-12-13 18:16 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2008-12-13 18:16 UTC (permalink / raw)
  To: tom.leiming; +Cc: kay.sievers, linux-kernel

On Sat, Dec 13, 2008 at 06:34:00PM +0800, tom.leiming@gmail.com wrote:
> From: Ming Lei <tom.leiming@gmail.com>
> 
> If cls->name contains substring which can be interpreted as
> format,maybe it causes oops, so fix it.

Why not fix the code that would set cls->name to such a wrong field?  I
don't see any in-kernel code that does this, do you?

thanks,

greg k-h

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

end of thread, other threads:[~2008-12-13 18:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-13 10:34 [PATCH] driver core: don't pass cls->name as format string in sysdev_class_register() tom.leiming
2008-12-13 18:16 ` Greg KH

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