[PATCH master 1/2] KASan: test_kasan: silence warning with newer GCC

Sascha Hauer sha at pengutronix.de
Tue Dec 13 00:37:17 PST 2022


On Mon, Dec 12, 2022 at 05:39:06PM +0100, Ahmad Fatoum wrote:
> Newer GCC will rightly complain about this being an out-of-bounds
> access. This is intended as the kasan command is meant to cause
> out-of-bounds accesses to test proper operation of KASan.
> 
> Thus silence the warning for this specific instance.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  lib/kasan/test_kasan.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/lib/kasan/test_kasan.c b/lib/kasan/test_kasan.c
> index d0ea91547711..14511cdb80bd 100644
> --- a/lib/kasan/test_kasan.c
> +++ b/lib/kasan/test_kasan.c
> @@ -290,6 +290,8 @@ static noinline void kasan_alloca_oob_left(void)
>  	char alloca_array[i];
>  	char *p = alloca_array - 1;
>  
> +	OPTIMIZER_HIDE_VAR(p);
> +
>  	pr_info("out-of-bounds to left on alloca\n");
>  	*(volatile char *)p;
>  }
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list