summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-10-29 15:56:19 +0100
committerRusty Russell <rusty@rustcorp.com.au>2009-10-28 23:26:20 +0100
commit3c7d76e371ac1a3802ae1673f5c63554af59325c (patch)
tree6b8d84acb92196b0f9f044f98fd1908f8f655c87
parentparam: fix NULL comparison on oom (diff)
downloadlinux-3c7d76e371ac1a3802ae1673f5c63554af59325c.tar.xz
linux-3c7d76e371ac1a3802ae1673f5c63554af59325c.zip
param: fix setting arrays of bool
We create a dummy struct kernel_param on the stack for parsing each array element, but we didn't initialize the flags word. This matters for arrays of type "bool", where the flag indicates if it really is an array of bools or unsigned int (old-style). Reported-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: stable@kernel.org
-rw-r--r--kernel/params.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 00520c43d88c..d656c276508d 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -300,6 +300,7 @@ static int param_array(const char *name,
unsigned int min, unsigned int max,
void *elem, int elemsize,
int (*set)(const char *, struct kernel_param *kp),
+ u16 flags,
unsigned int *num)
{
int ret;
@@ -309,6 +310,7 @@ static int param_array(const char *name,
/* Get the name right for errors. */
kp.name = name;
kp.arg = elem;
+ kp.flags = flags;
/* No equals sign? */
if (!val) {
@@ -354,7 +356,8 @@ int param_array_set(const char *val, struct kernel_param *kp)
unsigned int temp_num;
return param_array(kp->name, val, 1, arr->max, arr->elem,
- arr->elemsize, arr->set, arr->num ?: &temp_num);
+ arr->elemsize, arr->set, kp->flags,
+ arr->num ?: &temp_num);
}
int param_array_get(char *buffer, struct kernel_param *kp)