aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 00eee87510fe..4c97e55e86ee 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -763,10 +763,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
763 (unsigned long) count, (long long) pos); 763 (unsigned long) count, (long long) pos);
764 764
765 if (nr_segs != 1) 765 if (nr_segs != 1)
766 return -EINVAL;
767
768 if (count < 0)
769 goto out; 766 goto out;
767
770 retval = -EFAULT; 768 retval = -EFAULT;
771 if (!access_ok(VERIFY_WRITE, buf, count)) 769 if (!access_ok(VERIFY_WRITE, buf, count))
772 goto out; 770 goto out;
@@ -814,7 +812,7 @@ out:
814ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov, 812ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
815 unsigned long nr_segs, loff_t pos) 813 unsigned long nr_segs, loff_t pos)
816{ 814{
817 ssize_t retval; 815 ssize_t retval = -EINVAL;
818 struct file *file = iocb->ki_filp; 816 struct file *file = iocb->ki_filp;
819 struct address_space *mapping = file->f_mapping; 817 struct address_space *mapping = file->f_mapping;
820 /* XXX: temporary */ 818 /* XXX: temporary */
@@ -827,7 +825,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
827 (unsigned long) count, (long long) pos); 825 (unsigned long) count, (long long) pos);
828 826
829 if (nr_segs != 1) 827 if (nr_segs != 1)
830 return -EINVAL; 828 goto out;
831 829
832 retval = generic_write_checks(file, &pos, &count, 0); 830 retval = generic_write_checks(file, &pos, &count, 0);
833 if (retval) 831 if (retval)