linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jbd: Check return value of __getblk()
@ 2010-10-13  8:17 Namhyung Kim
  2010-10-14 10:22 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2010-10-13  8:17 UTC (permalink / raw)
  To: Andrew Morton, Jan Kara; +Cc: linux-ext4, linux-kernel

Fail journal creation if __getblk() returns NULL.  unlikely() is
added because it is called in a loop and we've been OK without
the check until now.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 fs/jbd/journal.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 7fee247..3290fe9 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -950,6 +950,8 @@ int journal_create(journal_t *journal)
 		if (err)
 			return err;
 		bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
+		if (unlikely(!bh))
+			return -ENOMEM;
 		lock_buffer(bh);
 		memset (bh->b_data, 0, journal->j_blocksize);
 		BUFFER_TRACE(bh, "marking dirty");
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] jbd: Check return value of __getblk()
  2010-10-13  8:17 [PATCH] jbd: Check return value of __getblk() Namhyung Kim
@ 2010-10-14 10:22 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2010-10-14 10:22 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, Jan Kara, linux-ext4, linux-kernel

On Wed 13-10-10 17:17:18, Namhyung Kim wrote:
> Fail journal creation if __getblk() returns NULL.  unlikely() is
> added because it is called in a loop and we've been OK without
> the check until now.
  Thanks. Merged.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-14 10:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-13  8:17 [PATCH] jbd: Check return value of __getblk() Namhyung Kim
2010-10-14 10:22 ` Jan Kara

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