Commit be7a02dd authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Fix MODULE_PARM for arrays of s.

I interpreted "1-10s" to mean a string of 1-10 chars.  It actually
means 1-10 comma-separated strings.
parent bec7aa00
...@@ -569,20 +569,6 @@ static int param_set_byte(const char *val, struct kernel_param *kp) ...@@ -569,20 +569,6 @@ static int param_set_byte(const char *val, struct kernel_param *kp)
return 0; return 0;
} }
static int param_string(const char *name, const char *val,
unsigned int min, unsigned int max,
char *dest)
{
if (strlen(val) < min || strlen(val) > max) {
printk(KERN_ERR
"Parameter %s length must be %u-%u characters\n",
name, min, max);
return -EINVAL;
}
strcpy(dest, val);
return 0;
}
extern int set_obsolete(const char *val, struct kernel_param *kp) extern int set_obsolete(const char *val, struct kernel_param *kp)
{ {
unsigned int min, max; unsigned int min, max;
...@@ -618,7 +604,8 @@ extern int set_obsolete(const char *val, struct kernel_param *kp) ...@@ -618,7 +604,8 @@ extern int set_obsolete(const char *val, struct kernel_param *kp)
return param_array(kp->name, val, min, max, obsparm->addr, return param_array(kp->name, val, min, max, obsparm->addr,
sizeof(long), param_set_long); sizeof(long), param_set_long);
case 's': case 's':
return param_string(kp->name, val, min, max, obsparm->addr); return param_array(kp->name, val, min, max, obsparm->addr,
sizeof(char *), param_set_charp);
} }
printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type); printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment