diff options
author | Michael Grigoriev <mag@luminal.org> | 2003-11-09 16:16:36 +0000 |
---|---|---|
committer | Michael Grigoriev <mag@luminal.org> | 2003-11-09 16:16:36 +0000 |
commit | 31dc225b7e959fb9dd0c21d8c8ad3f90055db674 (patch) | |
tree | faeab240e5f2c8b03ceb76fdc36b0d484930065b | |
parent | 37b3f3b9df367b00d9f9c1fa383af7bf30923bda (diff) |
Also check the return value of kmalloc in case of memory starvation.
-rw-r--r-- | kernel/file.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |