Commit 942f5de4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix modprobe_path and hotplug_path sizes and sysctl

From: Andy Whitcroft <apw@shadowen.org>

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.
Signed-off-by: default avatarAndy Whitcroft <apw@shadowen.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7f94e2a6
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#define KMOD_PATH_LEN 256
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
/* modprobe exit status on success, -ve on error. Return value /* modprobe exit status on success, -ve on error. Return value
* usually useless though. */ * usually useless though. */
......
...@@ -47,7 +47,7 @@ static struct workqueue_struct *khelper_wq; ...@@ -47,7 +47,7 @@ static struct workqueue_struct *khelper_wq;
/* /*
modprobe_path is set via /proc/sys. 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 * request_module - try to load a kernel module
...@@ -132,7 +132,7 @@ EXPORT_SYMBOL(request_module); ...@@ -132,7 +132,7 @@ EXPORT_SYMBOL(request_module);
events. the command is expected to load drivers when events. the command is expected to load drivers when
necessary, and may perform additional system setup. 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); EXPORT_SYMBOL(hotplug_path);
......
...@@ -392,7 +392,7 @@ static ctl_table kern_table[] = { ...@@ -392,7 +392,7 @@ static ctl_table kern_table[] = {
.ctl_name = KERN_MODPROBE, .ctl_name = KERN_MODPROBE,
.procname = "modprobe", .procname = "modprobe",
.data = &modprobe_path, .data = &modprobe_path,
.maxlen = 256, .maxlen = KMOD_PATH_LEN,
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dostring, .proc_handler = &proc_dostring,
.strategy = &sysctl_string, .strategy = &sysctl_string,
...@@ -403,7 +403,7 @@ static ctl_table kern_table[] = { ...@@ -403,7 +403,7 @@ static ctl_table kern_table[] = {
.ctl_name = KERN_HOTPLUG, .ctl_name = KERN_HOTPLUG,
.procname = "hotplug", .procname = "hotplug",
.data = &hotplug_path, .data = &hotplug_path,
.maxlen = 256, .maxlen = KMOD_PATH_LEN,
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dostring, .proc_handler = &proc_dostring,
.strategy = &sysctl_string, .strategy = &sysctl_string,
......
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