All of lore.kernel.org
 help / color / mirror / Atom feed
From: hujianyang <hujianyang@huawei.com>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>
Subject: [PATCH 1/4] UBIFS: Add missing error handling in create_default_filesystem()
Date: Wed, 11 Jun 2014 10:38:45 +0800	[thread overview]
Message-ID: <5397C135.9070607@huawei.com> (raw)
In-Reply-To: <5397C0E7.9070602@huawei.com>

In the end of create_default_filesystem(), we need to check
the return value of ubifs_write_node() to ensure if we have
successfully written the cs_node.

Signed-off-by: hujianyang <hujianyang@huawei.com>
---
 fs/ubifs/sb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 4c37607..7ba1378 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -332,6 +332,8 @@ static int create_default_filesystem(struct ubifs_info *c)
 	cs->ch.node_type = UBIFS_CS_NODE;
 	err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0);
 	kfree(cs);
+	if (err)
+		return err;

 	ubifs_msg("default file-system created");
 	return 0;
-- 
1.8.1.4

  reply	other threads:[~2014-06-11  2:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11  2:37 [PATCH 0/4] UBIFS: Fix code issues detected by Fortify hujianyang
2014-06-11  2:38 ` hujianyang [this message]
2014-06-11  2:40 ` [PATCH 2/4] UBIFS: Add missing error handling in dump_lpt_leb() hujianyang
2014-06-11  2:41 ` [PATCH 3/4] UBIFS: Add missing break in dbg_chk_pnode() hujianyang
2014-06-11  2:42 ` [PATCH 4/4] UBIFS: Remove useless statements hujianyang
2014-07-01 12:37   ` Artem Bityutskiy
2014-07-07  8:07     ` hujianyang
2014-07-01  1:19 ` [PATCH 0/4] UBIFS: Fix code issues detected by Fortify hujianyang
2014-07-01 12:38 ` Artem Bityutskiy

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=5397C135.9070607@huawei.com \
    --to=hujianyang@huawei.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.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 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.