linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, Bob Copeland <me@bobcopeland.com>
Subject: [PATCH 2/4] omfs: set error return when d_make_root() fails
Date: Mon, 18 May 2015 07:34:36 -0400	[thread overview]
Message-ID: <1431948878-3756-3-git-send-email-me@bobcopeland.com> (raw)
In-Reply-To: <1431948878-3756-1-git-send-email-me@bobcopeland.com>

A static checker found the following issue in the error path for
omfs_fill_super:

	fs/omfs/inode.c:552 omfs_fill_super()
	warn: missing error code here? 'd_make_root()' failed. 'ret' = '0'

Fix by returning -ENOMEM in this case.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
 fs/omfs/inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 70d4191cf33d..6ce542c11f98 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -549,8 +549,10 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
 	}
 
 	sb->s_root = d_make_root(root);
-	if (!sb->s_root)
+	if (!sb->s_root) {
+		ret = -ENOMEM;
 		goto out_brelse_bh2;
+	}
 	printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
 
 	ret = 0;
-- 
2.1.4


  parent reply	other threads:[~2015-05-18 11:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18 11:34 [PATCH 0/4] OMFS fixes Bob Copeland
2015-05-18 11:34 ` [PATCH 1/4] fs, omfs: add NULL terminator in the end up the token list Bob Copeland
2015-05-18 11:34 ` Bob Copeland [this message]
2015-05-18 11:34 ` [PATCH 3/4] omfs: fix sign confusion for bitmap loop counter Bob Copeland
2015-05-18 11:34 ` [PATCH 4/4] omfs: fix potential integer overflow in allocator Bob Copeland

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=1431948878-3756-3-git-send-email-me@bobcopeland.com \
    --to=me@bobcopeland.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).