Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: lkdtm: bugs: At least try to use popuated variable

The result may not be intereresting, but not using a set variable
is bad form and causes W=1 kernel builds to complain.

Fixes the following W=1 warning(s):

drivers/misc/lkdtm/bugs.c: In function ‘lkdtm_STACK_GUARD_PAGE_LEADING’:
drivers/misc/lkdtm/bugs.c:331:25: warning: variable ‘byte’ set but not used [-Wunused-but-set-variable]
331 | volatile unsigned char byte;
| ^~~~
drivers/misc/lkdtm/bugs.c: In function ‘lkdtm_STACK_GUARD_PAGE_TRAILING’:
drivers/misc/lkdtm/bugs.c:345:25: warning: variable ‘byte’ set but not used [-Wunused-but-set-variable]
345 | volatile unsigned char byte;
| ^~~~

Cc: Kees Cook <keescook@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200626130525.389469-5-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Lee Jones and committed by
Greg Kroah-Hartman
f049c545 3caf1b48

+2 -2
+2 -2
drivers/misc/lkdtm/bugs.c
··· 333 333 334 334 byte = *ptr; 335 335 336 - pr_err("FAIL: accessed page before stack!\n"); 336 + pr_err("FAIL: accessed page before stack! (byte: %x)\n", byte); 337 337 } 338 338 339 339 /* Test that VMAP_STACK is actually allocating with a trailing guard page */ ··· 347 347 348 348 byte = *ptr; 349 349 350 - pr_err("FAIL: accessed page after stack!\n"); 350 + pr_err("FAIL: accessed page after stack! (byte: %x)\n", byte); 351 351 } 352 352 353 353 void lkdtm_UNSET_SMEP(void)