VISIBLE_IF_KUNIT drops the static qualifier whenever CONFIG_KUNIT is
enabled but the prototypes for the two helpers it exposes are only
declared when CONFIG_USER_NS_MAP_KUNIT_TEST is set.

  kernel/user_namespace.c:787:22: warning: no previous prototype for 
'insert_extent' [-Wmissing-prototypes]
  kernel/user_namespace.c:860:22: warning: no previous prototype for 
'sort_idmaps' [-Wmissing-prototypes]

Guard the declarations on CONFIG_KUNIT so they match the definitions.

Fixes: f6f1a2496ba5 ("userns: Add KUnit test suite for uid_gid_map")
Reported-by: kernel test robot <[email protected]>
Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/
Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 include/linux/user_namespace.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 637cd7e91a45..91232053775d 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -208,11 +208,11 @@ extern bool in_userns(const struct user_namespace 
*ancestor,
 extern bool current_in_userns(const struct user_namespace *target_ns);
 struct ns_common *ns_get_owner(struct ns_common *ns);
 
-#if IS_ENABLED(CONFIG_USER_NS_MAP_KUNIT_TEST)
+#if IS_ENABLED(CONFIG_KUNIT)
 extern int uid_gid_map_insert_extent(struct uid_gid_map *map,
                                     struct uid_gid_extent *extent);
 extern int uid_gid_map_sort(struct uid_gid_map *map);
-#endif /* CONFIG_USER_NS_MAP_KUNIT_TEST */
+#endif /* CONFIG_KUNIT */
 
 #else
 
-- 
2.53.0


Reply via email to