linux-mtd.lists.infradead.org archive mirror
 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 2/4] UBIFS: Add missing error handling in dump_lpt_leb()
Date: Wed, 11 Jun 2014 10:40:10 +0800	[thread overview]
Message-ID: <5397C18A.60208@huawei.com> (raw)
In-Reply-To: <5397C0E7.9070602@huawei.com>

This patch checks the return value of ubifs_unpack_nnode().
If this function returns an error, @nnode may not be
initialized, so just print an error mesg and break.

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

diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 4b826ab..7e957b6 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -1941,6 +1941,11 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
 				pr_err("LEB %d:%d, nnode, ",
 				       lnum, offs);
 			err = ubifs_unpack_nnode(c, p, &nnode);
+			if (err) {
+				pr_err("failed to unpack_node, error %d\n",
+				       err);
+				break;
+			}
 			for (i = 0; i < UBIFS_LPT_FANOUT; i++) {
 				pr_cont("%d:%d", nnode.nbranch[i].lnum,
 				       nnode.nbranch[i].offs);
-- 
1.8.1.4

  parent reply	other threads:[~2014-06-11  2:42 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 ` [PATCH 1/4] UBIFS: Add missing error handling in create_default_filesystem() hujianyang
2014-06-11  2:40 ` hujianyang [this message]
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=5397C18A.60208@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 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).