Skip to content

Commit ed83677

Browse files
author
Ming Lei
committed
iov_iter: set nr_segs = 1 for ITER_UBUF
JIRA: https://issues.redhat.com/browse/RHEL-87739 commit cd0bd57 Author: Jens Axboe <axboe@kernel.dk> Date: Tue Mar 28 14:29:03 2023 -0600 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> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent 818e414 commit ed83677

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/uio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,
396396
.user_backed = true,
397397
.data_source = direction,
398398
.ubuf = buf,
399-
.count = count
399+
.count = count,
400+
.nr_segs = 1
400401
};
401402
}
402403
/* Flags for iov_iter_get/extract_pages*() */

0 commit comments

Comments
 (0)