tree b9adfc09908b0a7b6abe041f865cf335eac03056
parent fc9c9ab22d5650977c417ef2032d02f455011b23
author Bert Wesarg <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:25:42 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:25:42 -0700
[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 <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
params.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
Index: kernel/params.c
===================================================================
--- 27f9827f559cb732c78bb713e097c8a023e76768/kernel/params.c (mode:100644
sha1:5538608bd339b8ab81f1ea31d0cfc4797d19c84d)
+++ b9adfc09908b0a7b6abe041f865cf335eac03056/kernel/params.c (mode:100644
sha1:5513844bec1387855919f927965b2c8adf8b749d)
@@ -314,9 +314,10 @@
int param_array_set(const char *val, struct kernel_param *kp)
{
struct kparam_array *arr = kp->arg;
+ unsigned int temp_num;
return param_array(kp->name, val, 1, arr->max, arr->elem,
- arr->elemsize, arr->set, arr->num ?: &arr->max);
+ arr->elemsize, arr->set, arr->num ?: &temp_num);
}
int param_array_get(char *buffer, struct kernel_param *kp)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html