Skip to content

Commit

Permalink
Fix the signature for zone_import and zone_release
Browse files Browse the repository at this point in the history
These are cast to uma_import and uma_release functions. Use the signature
for these in the zone functions.

This was found with an experimental Kernel CFI. It will complain if the
signature is different than what a function pointer expects. The
simplest way to fix these is to correct the signature.

Reviewed by:	rlibby
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22671
  • Loading branch information
zxombie committed Dec 4, 2019
1 parent f531092 commit 44004fc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions sys/vm/uma_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ static void *slab_alloc_item(uma_keg_t keg, uma_slab_t slab);
static void slab_free_item(uma_zone_t zone, uma_slab_t slab, void *item);
static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit,
uma_fini fini, int align, uint32_t flags);
static int zone_import(uma_zone_t, void **, int, int, int);
static void zone_release(uma_zone_t, void **, int);
static int zone_import(void *, void **, int, int, int);
static void zone_release(void *, void **, int);
static void uma_zero_item(void *, uma_zone_t);
static bool cache_alloc(uma_zone_t, uma_cache_t, void *, int);
static bool cache_free(uma_zone_t, uma_cache_t, void *, void *, int);
Expand Down Expand Up @@ -2094,8 +2094,8 @@ zone_ctor(void *mem, int size, void *udata, int flags)
/*
* Use the regular zone/keg/slab allocator.
*/
zone->uz_import = (uma_import)zone_import;
zone->uz_release = (uma_release)zone_release;
zone->uz_import = zone_import;
zone->uz_release = zone_release;
zone->uz_arg = zone;
keg = arg->keg;

Expand Down Expand Up @@ -3112,15 +3112,17 @@ slab_alloc_item(uma_keg_t keg, uma_slab_t slab)
}

static int
zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags)
zone_import(void *arg, void **bucket, int max, int domain, int flags)
{
uma_zone_t zone;
uma_slab_t slab;
uma_keg_t keg;
#ifdef NUMA
int stripe;
#endif
int i;

zone = arg;
slab = NULL;
keg = zone->uz_keg;
KEG_LOCK(keg);
Expand Down Expand Up @@ -3616,14 +3618,16 @@ slab_free_item(uma_zone_t zone, uma_slab_t slab, void *item)
}

static void
zone_release(uma_zone_t zone, void **bucket, int cnt)
zone_release(void *arg, void **bucket, int cnt)
{
uma_zone_t zone;
void *item;
uma_slab_t slab;
uma_keg_t keg;
uint8_t *mem;
int i;

zone = arg;
keg = zone->uz_keg;
KEG_LOCK(keg);
for (i = 0; i < cnt; i++) {
Expand Down

0 comments on commit 44004fc

Please sign in to comment.