[PATCH -next RESEND] uts: Use KMEM_CACHE_USERCOPY() helper

From: Jinjie Ruan
Date: Thu Aug 29 2024 - 04:48:05 EST


Use KMEM_CACHE_USERCOPY() macro to simplify code.

Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
---
kernel/utsname.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/kernel/utsname.c b/kernel/utsname.c
index b1ac3ca870f2..b9917ea6142d 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -168,10 +168,5 @@ const struct proc_ns_operations utsns_operations = {

void __init uts_ns_init(void)
{
- uts_ns_cache = kmem_cache_create_usercopy(
- "uts_namespace", sizeof(struct uts_namespace), 0,
- SLAB_PANIC|SLAB_ACCOUNT,
- offsetof(struct uts_namespace, name),
- sizeof_field(struct uts_namespace, name),
- NULL);
+ uts_ns_cache = KMEM_CACHE_USERCOPY(uts_namespace, SLAB_PANIC | SLAB_ACCOUNT, name);
}
--
2.34.1