<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Bert Wesarg &lt;wesarg@informatik.uni-halle.de&gt;

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 &amp;.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" &gt; /sys/module/example/parameters/array
$ dmesg | tail -n 1
kernel: array: can take only 3 arguments

Signed-off-by: Bert Wesarg &lt;wesarg@informatik.uni-halle.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 25-akpm/kernel/params.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN kernel/params.c~kernel-paramc-dont-use-max-when-num-is-null-in kernel/params.c
--- 25/kernel/params.c~kernel-paramc-dont-use-max-when-num-is-null-in	2005-03-28 17:23:10.000000000 -0800
+++ 25-akpm/kernel/params.c	2005-03-28 17:23:10.000000000 -0800
@@ -314,9 +314,10 @@ int param_array(const char *name,
 int param_array_set(const char *val, struct kernel_param *kp)
 {
 	struct kparam_array *arr = kp-&gt;arg;
+	unsigned int temp_num;
 
 	return param_array(kp-&gt;name, val, 1, arr-&gt;max, arr-&gt;elem,
-			   arr-&gt;elemsize, arr-&gt;set, arr-&gt;num ?: &amp;arr-&gt;max);
+			   arr-&gt;elemsize, arr-&gt;set, arr-&gt;num ?: &amp;temp_num);
 }
 
 int param_array_get(char *buffer, struct kernel_param *kp)
_
</pre></body></html>