Also check the return value of kmalloc in case of memory starvation.
authorMichael Grigoriev <mag@luminal.org>
Sun, 9 Nov 2003 16:16:36 +0000 (16:16 +0000)
committerMichael Grigoriev <mag@luminal.org>
Sun, 9 Nov 2003 16:16:36 +0000 (16:16 +0000)
kernel/file.c

index 3e9b80b1070de6606dbff71ab6ff6d5804ebd514..41689412f4f0af9259a07ab9e0d3fb977f384161 100644 (file)
@@ -225,9 +225,13 @@ static ssize_t fuse_file_read(struct file *filp, char *buf,
                bl_end_index = bl_file_end_index;
 
        while (bl_index <= bl_end_index) {
+               int res;
                char *bl_buf = kmalloc(FUSE_BLOCK_SIZE, GFP_NOFS);
 
-               int res = fuse_is_block_uptodate(mapping, inode, bl_index);
+               if (!bl_buf)
+                       break;
+
+               res = fuse_is_block_uptodate(mapping, inode, bl_index);
 
                if (!res)
                        res = fuse_file_read_block(inode, bl_buf, bl_index);