diff options
author | Jason Liu <jason.hui.liu@nxp.com> | 2022-06-29 12:58:02 -0500 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2022-06-29 12:58:02 -0500 |
commit | 7928826df2e302fb0b9756e1b256ea269059a3a9 (patch) | |
tree | bca8b8524415a880b602bf9e7c8a8c62438c99e0 /lib/iov_iter.c | |
parent | eba369f0f66db8e57d52d788f455ebf80b52efa1 (diff) | |
parent | 18a33c8dabb88b50b860e0177a73933f2c0ddf68 (diff) |
Merge tag 'v5.15.50' into lf-5.15.y
This is the 5.15.50 stable release
* tag 'v5.15.50': (1395 commits)
Linux 5.15.50
arm64: mm: Don't invalidate FROM_DEVICE buffers at start of DMA transfer
serial: core: Initialize rs485 RTS polarity already on probe
...
Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
Conflicts:
drivers/bus/fsl-mc/fsl-mc-bus.c
drivers/crypto/caam/ctrl.c
drivers/pci/controller/dwc/pci-imx6.c
drivers/spi/spi-fsl-qspi.c
drivers/tty/serial/fsl_lpuart.c
include/uapi/linux/dma-buf.h
Diffstat (limited to 'lib/iov_iter.c')
-rw-r--r-- | lib/iov_iter.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 6d146f77601d..6cf2d66fb839 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1436,7 +1436,7 @@ static ssize_t iter_xarray_get_pages(struct iov_iter *i, { unsigned nr, offset; pgoff_t index, count; - size_t size = maxsize, actual; + size_t size = maxsize; loff_t pos; if (!size || !maxpages) @@ -1463,13 +1463,7 @@ static ssize_t iter_xarray_get_pages(struct iov_iter *i, if (nr == 0) return 0; - actual = PAGE_SIZE * nr; - actual -= offset; - if (nr == count && size > 0) { - unsigned last_offset = (nr > 1) ? 0 : offset; - actual -= PAGE_SIZE - (last_offset + size); - } - return actual; + return min_t(size_t, nr * PAGE_SIZE - offset, maxsize); } /* must be done on non-empty ITER_IOVEC one */ @@ -1604,7 +1598,7 @@ static ssize_t iter_xarray_get_pages_alloc(struct iov_iter *i, struct page **p; unsigned nr, offset; pgoff_t index, count; - size_t size = maxsize, actual; + size_t size = maxsize; loff_t pos; if (!size) @@ -1633,13 +1627,7 @@ static ssize_t iter_xarray_get_pages_alloc(struct iov_iter *i, if (nr == 0) return 0; - actual = PAGE_SIZE * nr; - actual -= offset; - if (nr == count && size > 0) { - unsigned last_offset = (nr > 1) ? 0 : offset; - actual -= PAGE_SIZE - (last_offset + size); - } - return actual; + return min_t(size_t, nr * PAGE_SIZE - offset, maxsize); } ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, |