Skip to contentSkip to conversation

mm,kmemleak-test: add the dependency on CONFIG_SAMPLES

PATCH In review chenxiang 2 participants 2 messages May 28, 2021

Subsystems (4)
lore
Share & tools
lore

chenxiang

author
#0 lore raw

PATCH v2 1/1 mm,kmemleak-test: add the dependency on CONFIG_SAMPLES

From: Xiang Chen <[email protected]>

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")
---
 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(-)
Documentation/dev-tools/kmemleak.rst +1 -1
index 1c935f4..997b35d 100644
@@ -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::
 
lib/Kconfig.debug +0 -8
index e88287e..b40931e 100644
@@ -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
samples/Kconfig +8 -0
index eaa06c0..3ce77c7 100644
@@ -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
samples/Makefile +1 -1
index 291663e..ffb404b 100644
@@ -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/
samples/kmemleak/Makefile +1 -1
index 16b6132..ce10176 100644
@@ -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
Signature · 1 line
2.8.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · chenxiang

From: Xiang Chen <[email protected]>

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")