[PATCH] reiserfs: missing kmalloc failure check
authorDiego Calleja <[email protected]>
Wed, 1 Feb 2006 11:06:44 +0000 (03:06 -0800)
committerLinus Torvalds <[email protected]>
Wed, 1 Feb 2006 16:53:25 +0000 (08:53 -0800)
According to http://bugzilla.kernel.org/show_bug.cgi?id=5778
fs/reiserfs/file.c is missing this check.

Signed-off-by: Diego Calleja <[email protected]>
Cc: Jeff Mahoney <[email protected]>
Cc: Chris Mason <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/reiserfs/file.c

index ad6fa964b0e7e892de207307223a71887d1bc6ac..1cad5d066a5c343705616c692fa2a9913588da38 100644 (file)
@@ -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. */