Skip to contentSkip to conversation

two 2.5 modules bugs

DISCUSSION Rusty Russell 1 participant 1 message Dec 30, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines

In message <[email protected]> you write:

Quoted 3 lines
Quoted 2 lines

long". The obvious fix (untested) is:

Tested. This patch makes the parport_pc module work again. Thanks.

Quoted 7 lines

Linus, please apply. Mikael, thanks for the excellent bug report!

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Fix MODULE_PARM for arrays of s.

And this as well. We restore the ","s after parsing: if expect to keep pointers to this stuff, we must not do that.

Linus, please apply.

kernel/params.c +3 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .5399-linux-2.5-bk/kernel/params.c .5399-linux-2.5-bk.updated/kernel/params.c
@@ -233,6 +233,7 @@ int param_array(const char *name,
 	int ret;
 	unsigned int count = 0;
 	struct kernel_param kp;
+	char save;
 
 	/* Get the name right for errors. */
 	kp.name = name;
@@ -247,7 +248,6 @@ int param_array(const char *name,
 	/* We expect a comma-separated list of values. */
 	do {
 		int len;
-		char save;
 
 		if (count > max) {
 			printk(KERN_ERR "%s: can only take %i arguments\n",
@@ -256,18 +256,17 @@ int param_array(const char *name,
 		}
 		len = strcspn(val, ",");
 
-		/* Temporarily nul-terminate and parse */
+		/* nul-terminate and parse */
 		save = val[len];
 		((char *)val)[len] = '\0';
 		ret = set(val, &kp);
-		((char *)val)[len] = save;
 
 		if (ret != 0)
 			return ret;
 		kp.arg += elemsize;
 		val += len+1;
 		count++;
-	} while (val[-1] == ',');
+	} while (save == ',');
 
 	if (count < min) {
 		printk(KERN_ERR "%s: needs at least %i arguments\n",