Skip to contentSkip to conversation

modprobe_path and hotplug_path sizes and sysctl

PATCH New Andy Whitcroft 1 participant 1 message Jun 9, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modprobe_path and hotplug_path sizes and sysctl

Both modprobe_path and hotplug_path are arbitrarily sized at 256 bytes and that size is also expressed directly in the sysctl code. It seems reasonable to define a standard length and use that for consitancy. This patch introduces the constant KMOD_PATH_LEN and uses that.

---
 include/linux/kmod.h |    2 ++
 kernel/kmod.c        |    4 ++--
 kernel/sysctl.c      |    4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)
include/linux/kmod.h +2 -0
diff -X /home/apw/lib/vdiff.excl -rupN reference/include/linux/kmod.h current/include/linux/kmod.h
@@ -23,6 +23,8 @@
 #include <linux/errno.h>
 #include <linux/compiler.h>
 
+#define KMOD_PATH_LEN 256
+
 #ifdef CONFIG_KMOD
 /* modprobe exit status on success, -ve on error.  Return value
  * usually useless though. */
kernel/kmod.c +2 -2
diff -X /home/apw/lib/vdiff.excl -rupN reference/kernel/kmod.c current/kernel/kmod.c
@@ -47,7 +47,7 @@ static struct workqueue_struct *khelper_
 /*
 	modprobe_path is set via /proc/sys.
 */
-char modprobe_path[256] = "/sbin/modprobe";
+char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe";
 
 /**
  * request_module - try to load a kernel module
@@ -132,7 +132,7 @@ EXPORT_SYMBOL(request_module);
 	events.  the command is expected to load drivers when
 	necessary, and may perform additional system setup.
 */
-char hotplug_path[256] = "/sbin/hotplug";
+char hotplug_path[KMOD_PATH_LEN] = "/sbin/hotplug";
 
 EXPORT_SYMBOL(hotplug_path);
 
kernel/sysctl.c +2 -2
diff -X /home/apw/lib/vdiff.excl -rupN reference/kernel/sysctl.c current/kernel/sysctl.c
@@ -392,7 +392,7 @@ static ctl_table kern_table[] = {
 		.ctl_name	= KERN_MODPROBE,
 		.procname	= "modprobe",
 		.data		= &modprobe_path,
-		.maxlen		= 256,
+		.maxlen		= KMOD_PATH_LEN,
 		.mode		= 0644,
 		.proc_handler	= &proc_dostring,
 		.strategy	= &sysctl_string,
@@ -403,7 +403,7 @@ static ctl_table kern_table[] = {
 		.ctl_name	= KERN_HOTPLUG,
 		.procname	= "hotplug",
 		.data		= &hotplug_path,
-		.maxlen		= 256,
+		.maxlen		= KMOD_PATH_LEN,
 		.mode		= 0644,
 		.proc_handler	= &proc_dostring,
 		.strategy	= &sysctl_string,