Skip to contentSkip to conversation

jbd: Check return value of __getblk()

PATCH In review Namhyung Kim 2 participants 2 messages Oct 13, 2010 – Oct 14, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jbd: Check return value of __getblk()

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.

---
 fs/jbd/journal.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/jbd/journal.c +2 -0
index 7fee247..3290fe9 100644
@@ -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");
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 3 lines · Namhyung Kim

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

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR