From: Xiang Chen <chenxiang66@xxxxxxxxxxxxx> As kmemleak-test.c is moved to samples dir, it is not compiled if just setting CONFIG_DEBUG_KMEMLEAK_TEST as module and enabling CONFIG_DEBUG_KMEMLEAK. So move the DEBUG_KMEMLEAK_TEST option to samples dir as well and rename it to SAMPLE_KMEMLEAK_TEST. And also replace DEBUG_KMEMLEAK_TEST with SAMPLE_KMEMLEAK_TEST in some other places. Fixes: 1abbef4f5172 ("mm,kmemleak-test.c: move kmemleak-test.c to samples dir") Signed-off-by: Xiang Chen <chenxiang66@xxxxxxxxxxxxx> --- Documentation/dev-tools/kmemleak.rst | 2 +- lib/Kconfig.debug | 8 -------- samples/Kconfig | 8 ++++++++ samples/Makefile | 2 +- samples/kmemleak/Makefile | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Documentation/dev-tools/kmemleak.rst b/Documentation/dev-tools/kmemleak.rst index 1c935f4..997b35d 100644 --- a/Documentation/dev-tools/kmemleak.rst +++ b/Documentation/dev-tools/kmemleak.rst @@ -228,7 +228,7 @@ Testing with kmemleak-test -------------------------- To check if you have all set up to use kmemleak, you can use the kmemleak-test -module, a module that deliberately leaks memory. Set CONFIG_DEBUG_KMEMLEAK_TEST +module, a module that deliberately leaks memory. Set CONFIG_SAMPLE_KMEMLEAK_TEST as module (it can't be used as built-in) and boot the kernel with kmemleak enabled. Load the module and perform a scan with:: diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index e88287e..b40931e 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -723,14 +723,6 @@ config DEBUG_KMEMLEAK_MEM_POOL_SIZE fully initialised, this memory pool acts as an emergency one if slab allocations fail. -config DEBUG_KMEMLEAK_TEST - tristate "Simple test for the kernel memory leak detector" - depends on DEBUG_KMEMLEAK && m - help - This option enables a module that explicitly leaks memory. - - If unsure, say N. - config DEBUG_KMEMLEAK_DEFAULT_OFF bool "Default kmemleak to off" depends on DEBUG_KMEMLEAK diff --git a/samples/Kconfig b/samples/Kconfig index eaa06c0..3ce77c7 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -223,6 +223,14 @@ config SAMPLE_WATCH_QUEUE Build example userspace program to use the new mount_notify(), sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function. +config SAMPLE_KMEMLEAK_TEST + tristate "Simple test for the kernel memory leak detector" + depends on DEBUG_KMEMLEAK && m + help + This option enables a module that explicitly leaks memory. + + If unsure, say N. + source "samples/rust/Kconfig" endif # SAMPLES diff --git a/samples/Makefile b/samples/Makefile index 291663e..ffb404b 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -29,5 +29,5 @@ subdir-$(CONFIG_SAMPLE_VFS) += vfs obj-$(CONFIG_SAMPLE_INTEL_MEI) += mei/ subdir-$(CONFIG_SAMPLE_WATCHDOG) += watchdog subdir-$(CONFIG_SAMPLE_WATCH_QUEUE) += watch_queue -obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak/ +obj-$(CONFIG_SAMPLE_KMEMLEAK_TEST) += kmemleak/ obj-$(CONFIG_SAMPLES_RUST) += rust/ diff --git a/samples/kmemleak/Makefile b/samples/kmemleak/Makefile index 16b6132..ce10176 100644 --- a/samples/kmemleak/Makefile +++ b/samples/kmemleak/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak-test.o +obj-$(CONFIG_SAMPLE_KMEMLEAK_TEST) += kmemleak-test.o -- 2.8.1