From 43cdff92ad47e0ca024c8a07d29f9bb6119e759c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastien=20Dugu=C3=A9?= Date: Fri, 29 Dec 2006 16:46:53 -0800 Subject: [PATCH] Fix IPMI watchdog set_param_str() using kstrdup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit set_param_str() cannot use kstrdup() to duplicate the parameter. That's fine when the driver is compiled as a module but it sure is not when built into the kernel as the kernel parameters are parsed before the kmalloc slabs are setup. Signed-off-by: Sebastien DuguĂ© Acked-by: Corey Minyard Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/ipmi/ipmi_watchdog.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 78280380a90..6b634e8d951 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -216,13 +216,13 @@ static int set_param_str(const char *val, struct kernel_param *kp) { action_fn fn = (action_fn) kp->arg; int rv = 0; - char *dup, *s; + char valcp[16]; + char *s; - dup = kstrdup(val, GFP_KERNEL); - if (!dup) - return -ENOMEM; + strncpy(valcp, val, 16); + valcp[15] = '\0'; - s = strstrip(dup); + s = strstrip(valcp); down_read(®ister_sem); rv = fn(s, NULL); @@ -235,7 +235,6 @@ static int set_param_str(const char *val, struct kernel_param *kp) out_unlock: up_read(®ister_sem); - kfree(dup); return rv; } -- cgit v1.2.3