Skip to content

Commit

Permalink
param: fix setting arrays of bool
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Cc: [email protected]
  • Loading branch information
rustyrussell committed Oct 28, 2009
1 parent d553ad8 commit 3c7d76e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3c7d76e

Please sign in to comment.