linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kulikov Vasiliy <segooon@gmail.com>
To: kernel-janitors@vger.kernel.org
Cc: Vasiliy Kulikov <segooon@gmail.com>, Neil Brown <neilb@suse.de>,
	linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 03/14] md: check return code of read_sb_page
Date: Sun,  5 Sep 2010 22:32:25 +0400	[thread overview]
Message-ID: <1283711546-7205-1-git-send-email-segooon@gmail.com> (raw)

From: Vasiliy Kulikov <segooon@gmail.com>

Function read_sb_page may return ERR_PTR(...). Check for it.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
 Compile tested.

 drivers/md/bitmap.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index ed4900a..33531da 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -936,6 +936,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
 	int outofdate;
 	int ret = -ENOSPC;
 	void *paddr;
+	struct page *p;
 
 	chunks = bitmap->chunks;
 	file = bitmap->file;
@@ -999,11 +1000,16 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
 				 */
 				page = bitmap->sb_page;
 				offset = sizeof(bitmap_super_t);
-				if (!file)
-					read_sb_page(bitmap->mddev,
+				if (!file) {
+					p = read_sb_page(bitmap->mddev,
 						     bitmap->mddev->bitmap_info.offset,
 						     page,
 						     index, count);
+					if (IS_ERR(p)) {
+						ret = PTR_ERR(p);
+						goto err;
+					}
+				}
 			} else if (file) {
 				page = read_page(file, index, bitmap, count);
 				offset = 0;
-- 
1.7.0.4

                 reply	other threads:[~2010-09-05 18:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1283711546-7205-1-git-send-email-segooon@gmail.com \
    --to=segooon@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).