aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/hostfs/hostfs_kern.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 8163aac81c21..67e556cbfd82 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -439,25 +439,27 @@ static int hostfs_readpage(struct file *file, struct page *page)
439{ 439{
440 char *buffer; 440 char *buffer;
441 long long start; 441 long long start;
442 int err = 0; 442 int bytes_read, ret;
443 443
444 start = (long long) page->index << PAGE_CACHE_SHIFT; 444 start = (long long) page->index << PAGE_CACHE_SHIFT;
445 buffer = kmap(page); 445 buffer = kmap(page);
446 err = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, 446 bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
447 PAGE_CACHE_SIZE); 447 PAGE_CACHE_SIZE);
448 if (err < 0) 448 if (bytes_read < 0) {
449 ret = bytes_read;
449 goto out; 450 goto out;
451 }
450 452
451 memset(&buffer[err], 0, PAGE_CACHE_SIZE - err); 453 memset(buffer + bytes_read, 0, PAGE_CACHE_SIZE - bytes_read);
452 454
453 flush_dcache_page(page); 455 flush_dcache_page(page);
454 SetPageUptodate(page); 456 SetPageUptodate(page);
455 if (PageError(page)) ClearPageError(page); 457 if (PageError(page)) ClearPageError(page);
456 err = 0; 458 ret = 0;
457 out: 459 out:
458 kunmap(page); 460 kunmap(page);
459 unlock_page(page); 461 unlock_page(page);
460 return err; 462 return ret;
461} 463}
462 464
463static int hostfs_write_begin(struct file *file, struct address_space *mapping, 465static int hostfs_write_begin(struct file *file, struct address_space *mapping,