aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-09-05 09:56:54 +0200
committerVlastimil Babka <vbabka@suse.cz>2024-09-10 11:42:58 +0200
commit199cd13a745eb44fb4828bca373155293cdcfa5c (patch)
tree66a1f541f04cd41ea81f66ef81b869ff16c7377d
parent052d67b46bcd91b6785e8e6e047241814f6142a3 (diff)
slab: port KMEM_CACHE_USERCOPY() to struct kmem_cache_args
Make KMEM_CACHE_USERCOPY() use struct kmem_cache_args. Reviewed-by: Kees Cook <kees@kernel.org> Reviewed-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
-rw-r--r--include/linux/slab.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1f38d94387cc..7e15a3a3edb1 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -294,12 +294,13 @@ int kmem_cache_shrink(struct kmem_cache *s);
* To whitelist a single field for copying to/from usercopy, use this
* macro instead for KMEM_CACHE() above.
*/
-#define KMEM_CACHE_USERCOPY(__struct, __flags, __field) \
- kmem_cache_create_usercopy(#__struct, \
- sizeof(struct __struct), \
- __alignof__(struct __struct), (__flags), \
- offsetof(struct __struct, __field), \
- sizeof_field(struct __struct, __field), NULL)
+#define KMEM_CACHE_USERCOPY(__struct, __flags, __field) \
+ __kmem_cache_create_args(#__struct, sizeof(struct __struct), \
+ &(struct kmem_cache_args) { \
+ .align = __alignof__(struct __struct), \
+ .useroffset = offsetof(struct __struct, __field), \
+ .usersize = sizeof_field(struct __struct, __field), \
+ }, (__flags))
/*
* Common kmalloc functions provided by all allocators