diff options
author | Bert Wesarg <wesarg@informatik.uni-halle.de> | 2005-04-16 18:25:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:25:42 -0400 |
commit | 31143a12044caa3521edafd736e3bc18c098d2fd (patch) | |
tree | b9adfc09908b0a7b6abe041f865cf335eac03056 /kernel/params.c | |
parent | fc9c9ab22d5650977c417ef2032d02f455011b23 (diff) |
[PATCH] kernel/param.c: don't use .max when .num is NULL in param_array_set()
there seems to be a bug, at least for me, in kernel/param.c for arrays with
.num == NULL. If .num == NULL, the function param_array_set() uses &.max
for the call to param_array(), wich alters the .max value to the number of
arguments. The result is, you can't set more array arguments as the last
time you set the parameter.
example:
# a module 'example' with
# static int array[10] = { 0, };
# module_param_array(array, int, NULL, 0644);
$ insmod example.ko array=1,2,3
$ cat /sys/module/example/parameters/array
1,2,3
$ echo "4,3,2,1" > /sys/module/example/parameters/array
$ dmesg | tail -n 1
kernel: array: can take only 3 arguments
Signed-off-by: Bert Wesarg <wesarg@informatik.uni-halle.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/params.c b/kernel/params.c index 5538608bd339..5513844bec13 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -314,9 +314,10 @@ int param_array(const char *name, | |||
314 | int param_array_set(const char *val, struct kernel_param *kp) | 314 | int param_array_set(const char *val, struct kernel_param *kp) |
315 | { | 315 | { |
316 | struct kparam_array *arr = kp->arg; | 316 | struct kparam_array *arr = kp->arg; |
317 | unsigned int temp_num; | ||
317 | 318 | ||
318 | return param_array(kp->name, val, 1, arr->max, arr->elem, | 319 | return param_array(kp->name, val, 1, arr->max, arr->elem, |
319 | arr->elemsize, arr->set, arr->num ?: &arr->max); | 320 | arr->elemsize, arr->set, arr->num ?: &temp_num); |
320 | } | 321 | } |
321 | 322 | ||
322 | int param_array_get(char *buffer, struct kernel_param *kp) | 323 | int param_array_get(char *buffer, struct kernel_param *kp) |