All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hareesh Nagarajan <hnagar2@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: mpm@selenic.com, ak@suse.de
Subject: [TRIVIAL] Error checks omitted in init_tmpfs() in mm/tiny-shmem.c
Date: Mon, 24 Oct 2005 00:29:45 -0500	[thread overview]
Message-ID: <435C7149.3010004@gmail.com> (raw)

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

The existing code in init_tmpfs() in mm/tiny-shmem.c does not handle the 
cases when the calls to register_filesystem() and kern_mount() fail. 
This patch adds those checks.

Signed-off-by: Hareesh Nagarajan <hnagar2@gmail.com>


[-- Attachment #2: tiny-shmmem-fix.patch --]
[-- Type: text/x-patch, Size: 623 bytes --]

--- linux-2.6.13.4/mm/tiny-shmem.c	2005-10-10 13:54:29.000000000 -0500
+++ linux-2.6.13.4-edit/mm/tiny-shmem.c	2005-10-24 00:13:10.532652000 -0500
@@ -31,12 +31,27 @@
 
 static int __init init_tmpfs(void)
 {
-	register_filesystem(&tmpfs_fs_type);
+	int error;
+
+	error = register_filesystem(&tmpfs_fs_type);
+	if (error) {
+		goto out2;
+	}
+
 #ifdef CONFIG_TMPFS
 	devfs_mk_dir("shm");
 #endif
 	shm_mnt = kern_mount(&tmpfs_fs_type);
+	if (IS_ERR(shm_mnt)) {
+		error = PTR_ERR(shm_mnt);
+		goto out1;
+	}
+
 	return 0;
+out1:
+	unregister_filesystem(&tmpfs_fs_type);
+out2:
+	return error;
 }
 module_init(init_tmpfs)
 

             reply	other threads:[~2005-10-24  5:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-24  5:29 Hareesh Nagarajan [this message]
2005-10-24  7:09 ` [TRIVIAL] Error checks omitted in init_tmpfs() in mm/tiny-shmem.c Matt Mackall
2005-10-24  8:56   ` Hareesh Nagarajan
2005-10-24 20:45     ` Matt Mackall
2005-10-24 21:00       ` Muli Ben-Yehuda
2005-10-24 21:08         ` Matt Mackall
2005-10-25  0:16       ` Hareesh Nagarajan

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=435C7149.3010004@gmail.com \
    --to=hnagar2@gmail.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.