]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
lib: kunit_iov_iter: add tests for extract_iter_to_sg
authorChristian A. Ehrhardt <lk@c--e.de>
Thu, 26 Mar 2026 21:49:05 +0000 (22:49 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 3 Apr 2026 06:36:23 +0000 (23:36 -0700)
commit0913b7554726aac089cab89b6f0877dafc30b2a0
tree97e9b1f76f42df7628330daec47ec59e1d80ef78
parent7278aa840b69e5a31826329ef893230d67cae811
lib: kunit_iov_iter: add tests for extract_iter_to_sg

Add test cases that test extract_iter_to_sg.

For each iterator type an iterator is loaded with a suitable buffer.  The
iterator is then extracted to a scatterlist with multiple calls to
extract_iter_to_sg.  The final scatterlist is copied into a scratch
buffer.

The test passes if the scratch buffer contains the same data as the
original buffer.

The new tests demonstrate bugs in extract_iter_to_sg for kvec and user
iterators that are fixed by the previous commits.

Link: https://lkml.kernel.org/r/20260326214905.818170-6-lk@c--e.de
Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
Cc: David Howells <dhowells@redhat.com>
Cc: David Gow <davidgow@google.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Petr Mladek <pmladek@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/tests/kunit_iov_iter.c