diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-10-29 10:56:19 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-10-28 18:26:20 -0400 |
commit | 3c7d76e371ac1a3802ae1673f5c63554af59325c (patch) | |
tree | 6b8d84acb92196b0f9f044f98fd1908f8f655c87 /kernel | |
parent | d553ad864e3b3dde3f1038d491e207021b2d6293 (diff) |
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
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/params.c | 5 |
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, | |||
300 | unsigned int min, unsigned int max, | 300 | unsigned int min, unsigned int max, |
301 | void *elem, int elemsize, | 301 | void *elem, int elemsize, |
302 | int (*set)(const char *, struct kernel_param *kp), | 302 | int (*set)(const char *, struct kernel_param *kp), |
303 | u16 flags, | ||
303 | unsigned int *num) | 304 | unsigned int *num) |
304 | { | 305 | { |
305 | int ret; | 306 | int ret; |
@@ -309,6 +310,7 @@ static int param_array(const char *name, | |||
309 | /* Get the name right for errors. */ | 310 | /* Get the name right for errors. */ |
310 | kp.name = name; | 311 | kp.name = name; |
311 | kp.arg = elem; | 312 | kp.arg = elem; |
313 | kp.flags = flags; | ||
312 | 314 | ||
313 | /* No equals sign? */ | 315 | /* No equals sign? */ |
314 | if (!val) { | 316 | if (!val) { |
@@ -354,7 +356,8 @@ int param_array_set(const char *val, struct kernel_param *kp) | |||
354 | unsigned int temp_num; | 356 | unsigned int temp_num; |
355 | 357 | ||
356 | return param_array(kp->name, val, 1, arr->max, arr->elem, | 358 | return param_array(kp->name, val, 1, arr->max, arr->elem, |
357 | arr->elemsize, arr->set, arr->num ?: &temp_num); | 359 | arr->elemsize, arr->set, kp->flags, |
360 | arr->num ?: &temp_num); | ||
358 | } | 361 | } |
359 | 362 | ||
360 | int param_array_get(char *buffer, struct kernel_param *kp) | 363 | int param_array_get(char *buffer, struct kernel_param *kp) |