summaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 1598e3bf9..11b5d02d2 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -4,15 +4,11 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
+#include <linux/mm.h>
#include <linux/locks.h>
#include <linux/fcntl.h>
-#include <linux/mm.h>
#include <asm/uaccess.h>
-#include <asm/system.h>
extern int *blk_size[];
extern int *blksize_size[];
@@ -204,8 +200,11 @@ ssize_t block_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
blocks = rblocks;
}
- if (block + blocks > size)
+ if (block + blocks > size) {
blocks = size - block;
+ if (blocks == 0)
+ return 0;
+ }
/* We do this in a two stage process. We first try to request
as many blocks as we can, then we wait for the first one to