From: Michael Grigoriev Date: Sun, 9 Nov 2003 16:16:36 +0000 (+0000) Subject: Also check the return value of kmalloc in case of memory starvation. X-Git-Tag: fuse_1_1_pre1~15 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=31dc225b7e959fb9dd0c21d8c8ad3f90055db674;p=qemu-gpiodev%2Flibfuse.git Also check the return value of kmalloc in case of memory starvation. --- 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);