Re: [PATCH mm v3] kasan: fix array-bounds warnings in tests

From: Kees Cook
Date: Mon Sep 26 2022 - 14:25:45 EST


On Mon, Sep 26, 2022 at 08:08:47PM +0200, andrey.konovalov@xxxxxxxxx wrote:
> From: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
>
> GCC's -Warray-bounds option detects out-of-bounds accesses to
> statically-sized allocations in krealloc out-of-bounds tests.
>
> Use OPTIMIZER_HIDE_VAR to suppress the warning.
>
> Also change kmalloc_memmove_invalid_size to use OPTIMIZER_HIDE_VAR
> instead of a volatile variable.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook