Thread (8 messages) 8 messages, 3 authors, 7d ago

Re: [RFC PATCH v2 1/3] capability: Move mk_kernel_cap() to header

flat view

From: Bradley Morgan <hidden>
Date: 2026-09-29 17:15:39
Also in: linux-fsdevel, linux-kselftest, lkml

On 29 September 2026 14:01:58 BST, Jinjie Ruan [off-list ref]
wrote:
Move mk_kernel_cap() from capability.c to the capability header file
so that it can be reused by other security modules.
Fair enoughh

Reviewed-by: Bradley Morgan <redacted>

quoted hunk ↗ jump to hunk
No functional change.

Signed-off-by: Jinjie Ruan <redacted>
---
include/linux/capability.h | 5 +++++
kernel/capability.c        | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/capability.h b/include/linux/capability.h
index f8532d92fcad..7921a0b3b04a 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -114,6 +114,11 @@ static inline bool cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
	return !(a.val & ~set.val);
}

+static inline kernel_cap_t mk_kernel_cap(u32 low, u32 high)
+{
+	return (kernel_cap_t) { (low | ((u64)high << 32)) & CAP_VALID_MASK };
+}
+
/* Used to decide between falling back on the old suser() or fsuser(). */

static inline kernel_cap_t cap_drop_fs_set(const kernel_cap_t a)
diff --git a/kernel/capability.c b/kernel/capability.c
index 90e6ab62f6db..0b8ec26ead0e 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -190,11 +190,6 @@ SYSCALL_DEFINE2(capget, cap_user_header_t, header, cap_user_data_t, dataptr)
	return 0;
}

-static kernel_cap_t mk_kernel_cap(u32 low, u32 high)
-{
-	return (kernel_cap_t) { (low | ((u64)high << 32)) & CAP_VALID_MASK };
-}
-
/**
 * sys_capset - set capabilities for a process or (*) a group of processes
 * @header: pointer to struct that contains capability version and
--- Thanks!
"I'm not a very positive person" - Linus torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help