summaryrefslogtreecommitdiff
path: root/lib/usercopy_kunit.c
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2024-06-19 13:25:17 -0700
committerShuah Khan <skhan@linuxfoundation.org>2024-07-02 10:11:40 -0600
commit4d6cf248325f686f256f2446f3f9d5fbab6e4356 (patch)
treea1425c854d4365cb9a37479ce979115a6d28fe1c /lib/usercopy_kunit.c
parentcf6219ee889fb304cf8192c707ad280d93baafc7 (diff)
kunit/usercopy: Disable testing on !CONFIG_MMU
Since arch_pick_mmap_layout() is an inline for non-MMU systems, disable this test there. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202406160505.uBge6TMY-lkp@intel.com/ Signed-off-by: Kees Cook <kees@kernel.org> Reviewed-by: Rae Moar <rmoar@google.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'lib/usercopy_kunit.c')
-rw-r--r--lib/usercopy_kunit.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/usercopy_kunit.c b/lib/usercopy_kunit.c
index 45f1e558c464..e819561a540d 100644
--- a/lib/usercopy_kunit.c
+++ b/lib/usercopy_kunit.c
@@ -290,6 +290,11 @@ static int usercopy_test_init(struct kunit *test)
struct usercopy_test_priv *priv;
unsigned long user_addr;
+ if (!IS_ENABLED(CONFIG_MMU)) {
+ kunit_skip(test, "Userspace allocation testing not available on non-MMU systems");
+ return 0;
+ }
+
priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv);
test->priv = priv;