[LTP] [PATCH] ksm05: Fix build warning/error with -Wnull-dereference

Petr Vorel pvorel@suse.cz
Mon Jun 25 16:10:40 CEST 2018


Hi Alistair,

> Using the Android clang build, which uses -Werror -Wnull-dereference,
> the following error is seen:

> testcases/kernel/mem/ksm/ksm05.c:81:3: error: indirection of
> non-volatile null pointer will be deleted, not trap
> [-Werror,-Wnull-dereference]
>   *(char *)NULL = 0;      /* SIGSEGV occurs as expected. */
>   ^~~~~~~~~~~~~
> testcases/kernel/mem/ksm/ksm05.c:81:3: note: consider using
> __builtin_trap() or qualifying pointer with 'volatile'
> 1 error generated.

> Change it to "volatile char *" which avoids this build issue, without
> negatively affecting the test.

> Signed-off-by: Alistair Strachan <astrachan@google.com>

Pushed, thanks for your patch.


Kind regards,
Petr


More information about the ltp mailing list