Skip to contentSkip to conversation

Modules with old-style parameters won't load

PATCH In review Andreas Gruenbacher 2 participants 2 messages Feb 19, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Modules with old-style parameters won't load

Modules may define static variables as old-style MODULE_PARM() parameters. If those variables are not actually used the compiler may optimize them out, which currently leads to a `module: falsely claims to have parameter param' error, and the module won't load.

Just ignore old-style parameter definitions for parameters that aren't actually there.

---

Note: currently the CONFIG_OBSOLETE_MODPARM option is hardwired to y. I don't know when old-style module parameters are expected to go away, but until then we should make sure that they actually work.

Andreas

kernel/module.c +4 -6
Index: linux-2.6.15/kernel/module.c
===================================================================
@@ -763,6 +763,10 @@ static int set_obsolete(const char *val,
 		max = simple_strtol(p, &endp, 10);
 	} else
 		max = min;
+	if (!obsparm->addr) {
+		/* Assume the compiler optimized out an unused parameter. */
+		return 0;
+	}
 	switch (*endp) {
 	case 'b':
 		return param_array(kp->name, val, min, max, obsparm->addr,
@@ -834,12 +838,6 @@ static int obsolete_params(const char *n
 		obsparm[i].addr
 			= (void *)find_local_symbol(sechdrs, symindex, strtab,
 						    sym_name);
-		if (!obsparm[i].addr) {
-			printk("%s: falsely claims to have parameter %s\n",
-			       name, obsparm[i].name);
-			ret = -EINVAL;
-			goto out;
-		}
 		kp[i].arg = &obsparm[i];
 	}

From: Andreas Gruenbacher <[email protected]>
Subject: Modules with old-style parameters won't load
References: 148245

Modules may define static variables as old-style MODULE_PARM() parameters. If those variables are not actually used, the compiler may optimize them out, which currently leads to a `module: falsely claims to have parameter param' error, and the module won't load. Just ignore parameter definitions for parameters that aren't actually there.

kernel/module.c +4 -6
Index: linux-2.6.15/kernel/module.c
===================================================================
@@ -763,6 +763,10 @@ static int set_obsolete(const char *val,
 		max = simple_strtol(p, &endp, 10);
 	} else
 		max = min;
+	if (!obsparm->addr) {
+		/* Assume the compiler optimized out an unused parameter. */
+		return 0;
+	}
 	switch (*endp) {
 	case 'b':
 		return param_array(kp->name, val, min, max, obsparm->addr,
@@ -834,12 +838,6 @@ static int obsolete_params(const char *n
 		obsparm[i].addr
 			= (void *)find_local_symbol(sechdrs, symindex, strtab,
 						    sym_name);
-		if (!obsparm[i].addr) {
-			printk("%s: falsely claims to have parameter %s\n",
-			       name, obsparm[i].name);
-			ret = -EINVAL;
-			goto out;
-		}
 		kp[i].arg = &obsparm[i];
 	}
 
#1 lore raw
Quoted 2 lines · Andreas Gruenbacher

Just ignore old-style parameter definitions for parameters that aren't actually there.

But please tell the user, that his settings are going to be ignored via printk, instead of silently ignoring him.

Regards

Ingo Oeser