Commit ba649f5b authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Greg Kroah-Hartman

[PATCH] cdev: protect against buggy drivers

Here is a better fix (thanks Greg) that allows long names for character
device objects.
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 6a2c20d7
......@@ -207,8 +207,8 @@ int register_chrdev(unsigned int major, const char *name,
cdev->owner = fops->owner;
cdev->ops = fops;
strcpy(cdev->kobj.name, name);
for (s = strchr(cdev->kobj.name, '/'); s; s = strchr(s, '/'))
kobject_set_name(&cdev->kobj, "%s", name);
for (s = strchr(kobject_name(&cdev->kobj),'/'); s; s = strchr(s, '/'))
*s = '!';
err = cdev_add(cdev, MKDEV(cd->major, 0), 256);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment