Re: [PATCH] protect against buggy drivers

From: Stephen Hemminger
Date: Fri Oct 08 2004 - 14:00:56 EST


Here is a better fix (thanks Greg) that allows long names for character
device objects.

Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxx>

diff -Nru a/fs/char_dev.c b/fs/char_dev.c
--- a/fs/char_dev.c 2004-10-08 11:14:29 -07:00
+++ b/fs/char_dev.c 2004-10-08 11:14:29 -07:00
@@ -207,8 +207,8 @@

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);


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