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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu,  4 Aug 2011 23:36:11 +0100
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Greg Kroah-Hartman <gregkh@...e.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Al Viro <viro@...iv.linux.org.uk>, linux-kernel@...r.kernel.org
Cc:	Grant Likely <grant.likely@...retlab.ca>
Subject: [PATCH] devtmpfs: Fix section mismatch on devtmpfsd()

devtmpfsd_init() references setup_done which is __initdata, but
devtmpfsd() is not an __init function.  The code is fine, because it
is never referenced after discarding __init sections, but it leaves
some additional code that can be discarded with the rest of __init and
it causes gcc to complain with a section mismatch warning.

This patch moves the discardable portion into a separate __init
function.

Compile tested on SPARC and ARM.

Signed-off-by: Grant Likely <grant.likely@...retlab.ca>
---
 drivers/base/devtmpfs.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 33e1bed..5bf4f33 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -386,19 +386,8 @@ static int handle(const char *name, mode_t mode, struct device *dev)
 		return handle_remove(name, dev);
 }
 
-static int devtmpfsd(void *p)
+static void devtmpfsd(void)
 {
-	char options[] = "mode=0755";
-	int *err = p;
-	*err = sys_unshare(CLONE_NEWNS);
-	if (*err)
-		goto out;
-	*err = sys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
-	if (*err)
-		goto out;
-	sys_chdir("/.."); /* will traverse into overmounted root */
-	sys_chroot(".");
-	complete(&setup_done);
 	while (1) {
 		spin_lock(&req_lock);
 		while (requests) {
@@ -418,6 +407,22 @@ static int devtmpfsd(void *p)
 		schedule();
 		__set_current_state(TASK_RUNNING);
 	}
+}
+
+static int __init devtmpfsd_run(void *p)
+{
+	char options[] = "mode=0755";
+	int *err = p;
+	*err = sys_unshare(CLONE_NEWNS);
+	if (*err)
+		goto out;
+	*err = sys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
+	if (*err)
+		goto out;
+	sys_chdir("/.."); /* will traverse into overmounted root */
+	sys_chroot(".");
+	complete(&setup_done);
+	devtmpfsd();
 	return 0;
 out:
 	complete(&setup_done);
@@ -437,7 +442,7 @@ int __init devtmpfs_init(void)
 		return err;
 	}
 
-	thread = kthread_run(devtmpfsd, &err, "kdevtmpfs");
+	thread = kthread_run(devtmpfsd_run, &err, "kdevtmpfs");
 	if (!IS_ERR(thread)) {
 		wait_for_completion(&setup_done);
 	} else {
-- 
1.7.4.1

--
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