Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c7d76e3 authored by Rusty Russell's avatar Rusty Russell
Browse files

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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
parent d553ad86
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -300,6 +300,7 @@ static int param_array(const char *name,
		       unsigned int min, unsigned int max,
		       unsigned int min, unsigned int max,
		       void *elem, int elemsize,
		       void *elem, int elemsize,
		       int (*set)(const char *, struct kernel_param *kp),
		       int (*set)(const char *, struct kernel_param *kp),
		       u16 flags,
		       unsigned int *num)
		       unsigned int *num)
{
{
	int ret;
	int ret;
@@ -309,6 +310,7 @@ static int param_array(const char *name,
	/* Get the name right for errors. */
	/* Get the name right for errors. */
	kp.name = name;
	kp.name = name;
	kp.arg = elem;
	kp.arg = elem;
	kp.flags = flags;


	/* No equals sign? */
	/* No equals sign? */
	if (!val) {
	if (!val) {
@@ -354,7 +356,8 @@ int param_array_set(const char *val, struct kernel_param *kp)
	unsigned int temp_num;
	unsigned int temp_num;


	return param_array(kp->name, val, 1, arr->max, arr->elem,
	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)
int param_array_get(char *buffer, struct kernel_param *kp)