[PATCH v7 2/8] lib/string_kunit: add correctness test for strnlen()

Kees Cook kees at kernel.org
Fri Jan 30 09:34:50 PST 2026


On Fri, Jan 30, 2026 at 10:50:12AM +0800, Feng Jiang wrote:
> Add a KUnit test for strnlen() to verify correctness across
> different string lengths and memory alignments. Use vmalloc()
> to place the NUL character at the page boundary to ensure
> over-reads are detected.
> 
> Suggested-by: Andy Shevchenko <andy at kernel.org>
> Suggested-by: Kees Cook <kees at kernel.org>
> Signed-off-by: Feng Jiang <jiangfeng at kylinos.cn>

Reviewed-by: Kees Cook <kees at kernel.org>

-- 
Kees Cook



More information about the linux-riscv mailing list