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]
Message-ID: <20061216193022.GA21145@slug>
Date:	Sat, 16 Dec 2006 19:30:22 +0000
From:	Frederik Deweerdt <deweerdt@...e.fr>
To:	Andrew Morton <akpm@...l.org>
Cc:	linux-kernel@...r.kernel.org, jean-paul.saman@....com
Subject: [-mm patch] noinitramfs cleanup

On Thu, Dec 14, 2006 at 10:59:13PM -0800, Andrew Morton wrote:
> 	ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.20-rc1/2.6.20-rc1-mm1/
> 
> +disable-init-initramfsc-updated.patch


Jean-Paul,

The following patch silences the following compile time warning introduced
by the disable-init-initramfsc-updated patch:

  CC      init/noinitramfs.o
  init/noinitramfs.c:42: warning : initialization from incompatible pointer type

In addition, I've cleaned up the headers and added some error handling.

Regards,
Frederik

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@...il.com>

diff --git a/init/noinitramfs.c b/init/noinitramfs.c
index 01f88c3..f4c1a3a 100644
--- a/init/noinitramfs.c
+++ b/init/noinitramfs.c
@@ -18,25 +18,35 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 #include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/fcntl.h>
-#include <linux/delay.h>
-#include <linux/string.h>
+#include <linux/stat.h>
+#include <linux/kdev_t.h>
 #include <linux/syscalls.h>
 
 /*
  * Create a simple rootfs that is similar to the default initramfs
  */
-static void __init default_rootfs(void)
+static int __init default_rootfs(void)
 {
-	int mkdir_err = sys_mkdir("/dev", 0755);
-	int err = sys_mknod((const char __user *) "/dev/console",
-				S_IFCHR | S_IRUSR | S_IWUSR,
-				new_encode_dev(MKDEV(5, 1)));
-	if (err == -EROFS)
-		printk("Warning: Failed to create a rootfs\n");
-	mkdir_err = sys_mkdir("/root", 0700);
+	int err;
+
+	err = sys_mkdir("/dev", 0755);
+	if (err < 0)
+		goto out;
+
+	err = sys_mknod((const char __user *) "/dev/console",
+			S_IFCHR | S_IRUSR | S_IWUSR,
+			new_encode_dev(MKDEV(5, 1)));
+	if (err < 0)
+		goto out;
+
+	err = sys_mkdir("/root", 0700);
+	if (err < 0)
+		goto out;
+
+	return 0;
+
+out:
+	printk(KERN_WARNING "Failed to create a rootfs\n");
+	return err;
 }
 rootfs_initcall(default_rootfs);
-
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