mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Modules with old-style parameters won't load
@ 2006-02-19 17:39 Andreas Gruenbacher
  2006-02-19 18:22 ` Ingo Oeser
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Gruenbacher @ 2006-02-19 17:39 UTC (permalink / raw)
  To: linux-kernel, akpm

[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]

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.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

---

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

Index: linux-2.6.15/kernel/module.c
===================================================================
--- linux-2.6.15.orig/kernel/module.c
+++ 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];
 	}

[-- Attachment #2: module-obsparm.diff --]
[-- Type: text/x-diff, Size: 1359 bytes --]

From: Andreas Gruenbacher <agruen@suse.de>
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.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

Index: linux-2.6.15/kernel/module.c
===================================================================
--- linux-2.6.15.orig/kernel/module.c
+++ 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];
 	}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Modules with old-style parameters won't load
  2006-02-19 17:39 [PATCH] Modules with old-style parameters won't load Andreas Gruenbacher
@ 2006-02-19 18:22 ` Ingo Oeser
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Oeser @ 2006-02-19 18:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andreas Gruenbacher, akpm

On Sunday 19 February 2006 18:39, Andreas Gruenbacher wrote:
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-19 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-19 17:39 [PATCH] Modules with old-style parameters won't load Andreas Gruenbacher
2006-02-19 18:22 ` Ingo Oeser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®