Skip to content

Commit

Permalink
jbd: Check return value of __getblk()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
namhyung authored and jankara committed Oct 27, 2010
1 parent 81a4e32 commit 2a0e338
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/jbd/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,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");
Expand Down

0 comments on commit 2a0e338

Please sign in to comment.