Skip to content

Commit

Permalink
iov_iter: set nr_segs = 1 for ITER_UBUF
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Mar 30, 2023
1 parent 6eb203e commit cd0bd57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/linux/uio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*() */
Expand Down

0 comments on commit cd0bd57

Please sign in to comment.