diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-03-28 14:29:03 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-03-30 08:12:29 -0600 |
commit | cd0bd57a9de59019fe99e9305a2337a66a4f9d39 (patch) | |
tree | d1bea986adafaad51b90b3a8687270719a2bf3bb /include/linux/uio.h | |
parent | 6eb203e1a868187cbc23ae3bad443dc929ca6cca (diff) |
iov_iter: set nr_segs = 1 for ITER_UBUF
To avoid needing to check if a given user backed iov_iter is of type
ITER_IOVEC or ITER_UBUF, set the number of segments for the ITER_UBUF
case to 1 as we're carrying a single segment.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/uio.h')
-rw-r--r-- | include/linux/uio.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h index 7f585ceedcb2..5dbd2dcab35c 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -355,7 +355,8 @@ static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction, .user_backed = true, .data_source = direction, .ubuf = buf, - .count = count + .count = count, + .nr_segs = 1 }; } /* Flags for iov_iter_get/extract_pages*() */ |