From e5dd259f78ba0fd0c7bfc5c52179dbbff3eb48aa Mon Sep 17 00:00:00 2001
From: Diego Calleja <diegocg@gmail.com>
Date: Wed, 1 Feb 2006 03:06:44 -0800
Subject: [PATCH] [PATCH] reiserfs: missing kmalloc failure check

According to http://bugzilla.kernel.org/show_bug.cgi?id=5778
fs/reiserfs/file.c is missing this check.

Signed-off-by: Diego Calleja <diegocg@gmail.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Chris Mason <mason@suse.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
 fs/reiserfs/file.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index ad6fa964b0e7e..1cad5d066a5c3 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -192,6 +192,8 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl
 
 	allocated_blocks = kmalloc((blocks_to_allocate + will_prealloc) *
 				   sizeof(b_blocknr_t), GFP_NOFS);
+	if (!allocated_blocks)
+		return -ENOMEM;
 
 	/* First we compose a key to point at the writing position, we want to do
 	   that outside of any locking region. */
-- 
GitLab