From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core patches for 2.6.10-rc1
Date: Fri, 22 Oct 2004 16:09:31 -0700 [thread overview]
Message-ID: <10984865713952@kroah.com> (raw)
In-Reply-To: <1098486571899@kroah.com>
ChangeSet 1.2019, 2004/10/22 14:01:16-07:00, shemminger@osdl.org
[PATCH] avoid problems with kobject_set_name and name with %
kobject_set_name takes a printf style argument list. There are many
callers that pass only one string, if this string contained a '%' character
than bad things would happen. The fix is simple.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/base/bus.c | 4 ++--
drivers/base/class.c | 4 ++--
drivers/base/core.c | 2 +-
drivers/firmware/efivars.c | 2 +-
drivers/pci/hotplug/pci_hotplug_core.c | 2 +-
fs/sysfs/dir.c | 2 +-
kernel/module.c | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c 2004-10-22 16:00:16 -07:00
+++ b/drivers/base/bus.c 2004-10-22 16:00:16 -07:00
@@ -515,7 +515,7 @@
if (bus) {
pr_debug("bus %s: add driver %s\n", bus->name, drv->name);
- error = kobject_set_name(&drv->kobj, drv->name);
+ error = kobject_set_name(&drv->kobj, "%s", drv->name);
if (error) {
put_bus(bus);
return error;
@@ -666,7 +666,7 @@
{
int retval;
- retval = kobject_set_name(&bus->subsys.kset.kobj, bus->name);
+ retval = kobject_set_name(&bus->subsys.kset.kobj, "%s", bus->name);
if (retval)
goto out;
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c 2004-10-22 16:00:16 -07:00
+++ b/drivers/base/class.c 2004-10-22 16:00:16 -07:00
@@ -139,7 +139,7 @@
INIT_LIST_HEAD(&cls->children);
INIT_LIST_HEAD(&cls->interfaces);
- error = kobject_set_name(&cls->subsys.kset.kobj, cls->name);
+ error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name);
if (error)
return error;
@@ -368,7 +368,7 @@
class_dev->class_id);
/* first, register with generic layer. */
- kobject_set_name(&class_dev->kobj, class_dev->class_id);
+ kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id);
if (parent)
class_dev->kobj.parent = &parent->subsys.kset.kobj;
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c 2004-10-22 16:00:16 -07:00
+++ b/drivers/base/core.c 2004-10-22 16:00:16 -07:00
@@ -221,7 +221,7 @@
pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id);
/* first, register with generic layer. */
- kobject_set_name(&dev->kobj, dev->bus_id);
+ kobject_set_name(&dev->kobj, "%s", dev->bus_id);
if (parent)
dev->kobj.parent = &parent->kobj;
diff -Nru a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
--- a/drivers/firmware/efivars.c 2004-10-22 16:00:16 -07:00
+++ b/drivers/firmware/efivars.c 2004-10-22 16:00:16 -07:00
@@ -640,7 +640,7 @@
*(short_name + strlen(short_name)) = '-';
efi_guid_unparse(vendor_guid, short_name + strlen(short_name));
- kobject_set_name(&new_efivar->kobj, short_name);
+ kobject_set_name(&new_efivar->kobj, "%s", short_name);
kobj_set_kset_s(new_efivar, vars_subsys);
kobject_register(&new_efivar->kobj);
diff -Nru a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
--- a/drivers/pci/hotplug/pci_hotplug_core.c 2004-10-22 16:00:16 -07:00
+++ b/drivers/pci/hotplug/pci_hotplug_core.c 2004-10-22 16:00:16 -07:00
@@ -568,7 +568,7 @@
if ((slot->info == NULL) || (slot->ops == NULL))
return -EINVAL;
- kobject_set_name(&slot->kobj, slot->name);
+ kobject_set_name(&slot->kobj, "%s", slot->name);
kobj_set_kset_s(slot, pci_hotplug_slots_subsys);
/* this can fail if we have already registered a slot with the same name */
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--- a/fs/sysfs/dir.c 2004-10-22 16:00:16 -07:00
+++ b/fs/sysfs/dir.c 2004-10-22 16:00:16 -07:00
@@ -181,7 +181,7 @@
new_dentry = sysfs_get_dentry(parent, new_name);
if (!IS_ERR(new_dentry)) {
if (!new_dentry->d_inode) {
- error = kobject_set_name(kobj,new_name);
+ error = kobject_set_name(kobj, "%s", new_name);
if (!error)
d_move(kobj->dentry, new_dentry);
}
diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c 2004-10-22 16:00:16 -07:00
+++ b/kernel/module.c 2004-10-22 16:00:16 -07:00
@@ -1120,7 +1120,7 @@
return -ENOMEM;
memset(&mod->mkobj->kobj, 0, sizeof(mod->mkobj->kobj));
- err = kobject_set_name(&mod->mkobj->kobj, mod->name);
+ err = kobject_set_name(&mod->mkobj->kobj, "%s", mod->name);
if (err)
goto out;
kobj_set_kset_s(mod->mkobj, module_subsys);
next prev parent reply other threads:[~2004-10-23 3:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-22 23:09 [BK PATCH] Driver Core patches for 2.6.10-rc1 Greg KH
2004-10-22 23:09 ` [PATCH] " Greg KH
2004-10-22 23:09 ` Greg KH
2004-10-22 23:09 ` Greg KH [this message]
2004-10-22 23:09 ` Greg KH
2004-10-22 23:09 ` Greg KH
2004-10-22 23:09 ` Greg KH
2004-10-22 23:09 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2004-11-01 21:54 [BK PATCH] " Greg KH
2004-11-01 21:57 ` [PATCH] " Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-01 21:57 ` Greg KH
2004-11-02 22:32 ` Russell King
2004-11-07 15:28 ` Russell King
2004-11-10 1:37 ` Greg KH
2004-11-10 2:57 ` Paul Mackerras
2004-11-10 8:36 ` Russell King
2004-11-10 21:36 ` Paul Mackerras
2004-11-11 0:00 ` Nigel Cunningham
2004-11-11 20:52 ` Russell King
2004-11-12 0:28 ` Greg KH
2004-11-01 23:44 ` Pozsar Balazs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10984865713952@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).