public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Richard Henderson <rth@twiddle.net>, Miles Bader <miles@gnu.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Make `obsolete params' work correctly if MODULE_SYMBOL_PREFIX is non-empty
Date: Sat, 11 Jan 2003 15:20:47 +1100	[thread overview]
Message-ID: <20030111050918.99C762C04F@lists.samba.org> (raw)
In-Reply-To: Your message of "Fri, 10 Jan 2003 09:03:41 -0800." <Pine.LNX.4.44.0301100902380.12833-100000@home.transmeta.com>

In message <Pine.LNX.4.44.0301100902380.12833-100000@home.transmeta.com> you wr
ite:
> 
> On Fri, 10 Jan 2003, Rusty Russell wrote:
> > 
> > Yep.  Maximum length of obsolete parameter name in current kernel:
> > seq_default_timer_resolution (28 chars).
> 
> Don't do this. Make the limit fixed, and check it.

Just in case someone names a variable over 2000 chars, and uses it as
an old-style module parameter?

Done, with protest.  Please apply.

Rusty.
(Miles, your sizeof also merged).
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Make obsolete module parameters work with MODULE_SYMBOL_PREFIX
Author: Miles Bader
Status: Trivial

D: Since these are just symbols in the module object, they need symbol name
D: munging to find the symbol from the parameter name.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .15543-linux-2.5-bk/kernel/module.c .15543-linux-2.5-bk.updated/kernel/module.c
--- .15543-linux-2.5-bk/kernel/module.c	2003-01-10 10:55:43.000000000 +1100
+++ .15543-linux-2.5-bk.updated/kernel/module.c	2003-01-11 15:15:59.000000000 +1100
@@ -680,18 +680,31 @@ static int obsolete_params(const char *n
 		return -ENOMEM;
 
 	DEBUGP("Module %s has %u obsolete params\n", name, num);
-	for (i = 0; i < num; i++)
+	for (i = 0; i < num; i++) {
+		if (strlen(obsparm[i].name) > 1024) {
+			printk("%s: Huge parameter.  Linus 1, Rusty 0.\n",
+			       name);
+			ret = -EINVAL;
+			goto out;
+		}
 		DEBUGP("Param %i: %s type %s\n",
 		       num, obsparm[i].name, obsparm[i].type);
+	}
 
 	for (i = 0; i < num; i++) {
+		char sym_name[strlen(obsparm[i].name)
+			     + sizeof(MODULE_SYMBOL_PREFIX)];
+
+		strcpy(sym_name, MODULE_SYMBOL_PREFIX);
+		strcat(sym_name, obsparm[i].name);
+
 		kp[i].name = obsparm[i].name;
 		kp[i].perm = 000;
 		kp[i].set = set_obsolete;
 		kp[i].get = NULL;
 		obsparm[i].addr
 			= (void *)find_local_symbol(sechdrs, symindex, strtab,
-						    obsparm[i].name);
+						    sym_name);
 		if (!obsparm[i].addr) {
 			printk("%s: falsely claims to have parameter %s\n",
 			       name, obsparm[i].name);

  reply	other threads:[~2003-01-11  5:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-07  6:32 [PATCH] Make `obsolete params' work correctly if MODULE_SYMBOL_PREFIX is non-empty Miles Bader
2003-01-08 11:56 ` Rusty Russell
2003-01-10  7:39   ` Miles Bader
2003-01-11 14:50     ` Bill Davidsen
2003-01-10  9:52   ` Richard Henderson
2003-01-10 10:20     ` Rusty Russell
2003-01-10 17:03       ` Linus Torvalds
2003-01-11  4:20         ` Rusty Russell [this message]
2003-01-11  5:36           ` Linus Torvalds
2003-01-11 13:42             ` Rusty Russell
2003-01-10 10:39   ` Miles Bader
  -- strict thread matches above, loose matches on Subject: below --
2003-01-09  9:49 Miles Bader
2003-01-10  8:31 ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030111050918.99C762C04F@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miles@gnu.org \
    --cc=rth@twiddle.net \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox