diff options
author | Dan Williams <dan.j.williams@intel.com> | 2018-06-09 00:16:44 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2018-06-09 00:16:44 +0200 |
commit | 930218affeadd1325ea17e053f0dcecf218f5a4f (patch) | |
tree | 203c293668a88e03b9f292cf4d5a294ca8a4275a /fs/dax.c | |
parent | Merge branch 'for-4.18/dax' into libnvdimm-for-next (diff) | |
parent | x86, nfit_test: Add unit test for memcpy_mcsafe() (diff) | |
download | linux-930218affeadd1325ea17e053f0dcecf218f5a4f.tar.xz linux-930218affeadd1325ea17e053f0dcecf218f5a4f.zip |
Merge branch 'for-4.18/mcsafe' into libnvdimm-for-next
Diffstat (limited to 'fs/dax.c')
-rw-r--r-- | fs/dax.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1082,6 +1082,7 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, struct iov_iter *iter = data; loff_t end = pos + length, done = 0; ssize_t ret = 0; + size_t xfer; int id; if (iov_iter_rw(iter) == READ) { @@ -1145,18 +1146,20 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, * vfs_write(), depending on which operation we are doing. */ if (iov_iter_rw(iter) == WRITE) - map_len = dax_copy_from_iter(dax_dev, pgoff, kaddr, + xfer = dax_copy_from_iter(dax_dev, pgoff, kaddr, map_len, iter); else - map_len = copy_to_iter(kaddr, map_len, iter); - if (map_len <= 0) { - ret = map_len ? map_len : -EFAULT; - break; - } + xfer = dax_copy_to_iter(dax_dev, pgoff, kaddr, + map_len, iter); - pos += map_len; - length -= map_len; - done += map_len; + pos += xfer; + length -= xfer; + done += xfer; + + if (xfer == 0) + ret = -EFAULT; + if (xfer < map_len) + break; } dax_read_unlock(id); |