[PATCH] driver core: don't pass cls->name as format string in sysdev_class_register()

From: tom . leiming
Date: Sat Dec 13 2008 - 05:34:25 EST


From: Ming Lei <tom.leiming@xxxxxxxxx>

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@xxxxxxxxx>
---
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

--
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/