linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 03/14] md: check return code of read_sb_page
@ 2010-09-05 18:32 Kulikov Vasiliy
  0 siblings, 0 replies; only message in thread
From: Kulikov Vasiliy @ 2010-09-05 18:32 UTC (permalink / raw)
  To: kernel-janitors; +Cc: Vasiliy Kulikov, Neil Brown, linux-raid, linux-kernel

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-05 18:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-05 18:32 [PATCH 03/14] md: check return code of read_sb_page Kulikov Vasiliy

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).