diff options
author | Sebastien Dugué <sebastien.dugue@bull.net> | 2006-12-29 19:46:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-30 13:55:54 -0500 |
commit | 43cdff92ad47e0ca024c8a07d29f9bb6119e759c (patch) | |
tree | 3f7b65d311012d3c02082da41af174ce9b779589 | |
parent | 7479b1ce5ea41a828002c60739cff37f47b62913 (diff) |
[PATCH] Fix IPMI watchdog set_param_str() using kstrdup
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é <sebastien.dugue@bull.net>
Acked-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 78280380a905..6b634e8d9519 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) | |||
216 | { | 216 | { |
217 | action_fn fn = (action_fn) kp->arg; | 217 | action_fn fn = (action_fn) kp->arg; |
218 | int rv = 0; | 218 | int rv = 0; |
219 | char *dup, *s; | 219 | char valcp[16]; |
220 | char *s; | ||
220 | 221 | ||
221 | dup = kstrdup(val, GFP_KERNEL); | 222 | strncpy(valcp, val, 16); |
222 | if (!dup) | 223 | valcp[15] = '\0'; |
223 | return -ENOMEM; | ||
224 | 224 | ||
225 | s = strstrip(dup); | 225 | s = strstrip(valcp); |
226 | 226 | ||
227 | down_read(®ister_sem); | 227 | down_read(®ister_sem); |
228 | rv = fn(s, NULL); | 228 | rv = fn(s, NULL); |
@@ -235,7 +235,6 @@ static int set_param_str(const char *val, struct kernel_param *kp) | |||
235 | 235 | ||
236 | out_unlock: | 236 | out_unlock: |
237 | up_read(®ister_sem); | 237 | up_read(®ister_sem); |
238 | kfree(dup); | ||
239 | return rv; | 238 | return rv; |
240 | } | 239 | } |
241 | 240 | ||