Skip to content

Commit

Permalink
slab: port kmem_cache_create_usercopy() to struct kmem_cache_args
Browse files Browse the repository at this point in the history
Port kmem_cache_create_usercopy() to struct kmem_cache_args and remove
the now unused do_kmem_cache_create_usercopy() helper.

Reviewed-by: Kees Cook <[email protected]>
Reviewed-by: Jens Axboe <[email protected]>
Reviewed-by: Mike Rapoport (Microsoft) <[email protected]>
Reviewed-by: Vlastimil Babka <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Reviewed-by: Roman Gushchin <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>
  • Loading branch information
brauner authored and tehcaster committed Sep 10, 2024
1 parent 9816c3c commit 1d3d764
Showing 1 changed file with 8 additions and 22 deletions.
30 changes: 8 additions & 22 deletions mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,26 +351,6 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
}
EXPORT_SYMBOL(__kmem_cache_create_args);

static struct kmem_cache *
do_kmem_cache_create_usercopy(const char *name,
unsigned int size, unsigned int freeptr_offset,
unsigned int align, slab_flags_t flags,
unsigned int useroffset, unsigned int usersize,
void (*ctor)(void *))
{
struct kmem_cache_args kmem_args = {
.align = align,
.use_freeptr_offset = freeptr_offset != UINT_MAX,
.freeptr_offset = freeptr_offset,
.useroffset = useroffset,
.usersize = usersize,
.ctor = ctor,
};

return __kmem_cache_create_args(name, size, &kmem_args, flags);
}


/**
* kmem_cache_create_usercopy - Create a cache with a region suitable
* for copying to userspace
Expand Down Expand Up @@ -405,8 +385,14 @@ kmem_cache_create_usercopy(const char *name, unsigned int size,
unsigned int useroffset, unsigned int usersize,
void (*ctor)(void *))
{
return do_kmem_cache_create_usercopy(name, size, UINT_MAX, align, flags,
useroffset, usersize, ctor);
struct kmem_cache_args kmem_args = {
.align = align,
.ctor = ctor,
.useroffset = useroffset,
.usersize = usersize,
};

return __kmem_cache_create_args(name, size, &kmem_args, flags);
}
EXPORT_SYMBOL(kmem_cache_create_usercopy);

Expand Down

0 comments on commit 1d3d764

Please sign in to comment.