From 31dc225b7e959fb9dd0c21d8c8ad3f90055db674 Mon Sep 17 00:00:00 2001 From: Michael Grigoriev Date: Sun, 9 Nov 2003 16:16:36 +0000 Subject: [PATCH] Also check the return value of kmalloc in case of memory starvation. --- kernel/file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/file.c b/kernel/file.c index 3e9b80b..4168941 100644 --- a/kernel/file.c +++ b/kernel/file.c @@ -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); -- 2.30.2