Re: [PATCH v7 2/8] lib/string_kunit: add correctness test for strnlen()
From: Kees Cook
Date: Fri Jan 30 2026 - 12:38:52 EST
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@xxxxxxxxxx>
> Suggested-by: Kees Cook <kees@xxxxxxxxxx>
> Signed-off-by: Feng Jiang <jiangfeng@xxxxxxxxxx>
Reviewed-by: Kees Cook <kees@xxxxxxxxxx>
--
Kees Cook