lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 15 Feb 2009 19:20:25 +0100
From:	Andreas Robinson <andr345@...il.com>
To:	sam@...nborg.org, rusty@...tcorp.com.au
Cc:	linux-kernel@...r.kernel.org
Subject: [RFC PATCH 3/6] module: always prefix module parameters with the module name

The parameters in statically linked modules now end up in the
proper sysfs directories, ie /sys/module/<modname>/parameter/*
---
 include/linux/moduleparam.h |    2 +-
 kernel/params.c             |   17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index e4af339..0cb2867 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -7,7 +7,7 @@
 
 /* You can override this manually, but generally this should match the
    module name. */
-#ifdef MODULE
+#if defined(MODULE) && !defined(CONFIG_MODULE_STATIC)
 #define MODULE_PARAM_PREFIX /* empty */
 #else
 #define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
diff --git a/kernel/params.c b/kernel/params.c
index a1e3025..22af6ee 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -518,6 +518,19 @@ static void free_module_param_attrs(struct module_kobject *mk)
 	mk->mp = NULL;
 }
 
+#ifdef CONFIG_MODULE_STATIC
+static const char *skip_param_modname(const char *name)
+{
+	const char *dot = strchr(name, '.');
+	return (!dot) ? name : dot + 1;
+}
+#else
+static const char *skip_param_modname(const char *name)
+{
+	return name;
+}
+#endif
+
 /*
  * module_param_sysfs_setup - setup sysfs support for one module
  * @mod: module
@@ -535,9 +548,11 @@ int module_param_sysfs_setup(struct module *mod,
 	bool params = false;
 
 	for (i = 0; i < num_params; i++) {
+		const char *name;
 		if (kparam[i].perm == 0)
 			continue;
-		err = add_sysfs_param(&mod->mkobj, &kparam[i], kparam[i].name);
+		name = skip_param_modname(kparam[i].name);
+		err = add_sysfs_param(&mod->mkobj, &kparam[i], name);
 		if (err)
 			return err;
 		params = true;
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ