From ebb0b7ecdadb197ee4a399944a1ea7862a288b70 Mon Sep 17 00:00:00 2001 From: rwatson Date: Tue, 18 Nov 2003 04:11:52 +0000 Subject: Use UMA zone allocator for Biba and MLS labels rather than MALLOC(9). Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories --- sys/security/mac_mls/mac_mls.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/security/mac_mls') diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c index d4e7634..e3c2ef4 100644 --- a/sys/security/mac_mls/mac_mls.c +++ b/sys/security/mac_mls/mac_mls.c @@ -72,6 +72,7 @@ #include #include +#include #include #include @@ -113,7 +114,7 @@ SYSCTL_INT(_security_mac_mls, OID_AUTO, max_compartments, CTLFLAG_RD, static int mac_mls_slot; #define SLOT(l) ((struct mac_mls *)LABEL_TO_SLOT((l), mac_mls_slot).l_ptr) -MALLOC_DEFINE(M_MACMLS, "mls label", "MAC/MLS labels"); +static uma_zone_t zone_mls; static __inline int mls_bit_set_empty(u_char *set) { @@ -128,11 +129,8 @@ mls_bit_set_empty(u_char *set) { static struct mac_mls * mls_alloc(int flag) { - struct mac_mls *mac_mls; - - mac_mls = malloc(sizeof(struct mac_mls), M_MACMLS, M_ZERO | flag); - return (mac_mls); + return (uma_zalloc(zone_mls, flag | M_ZERO)); } static void @@ -140,7 +138,7 @@ mls_free(struct mac_mls *mac_mls) { if (mac_mls != NULL) - free(mac_mls, M_MACMLS); + uma_zfree(zone_mls, mac_mls); else atomic_add_int(&destroyed_not_inited, 1); } @@ -458,6 +456,8 @@ static void mac_mls_init(struct mac_policy_conf *conf) { + zone_mls = uma_zcreate("mac_mls", sizeof(struct mac_mls), NULL, + NULL, NULL, NULL, UMA_ALIGN_PTR, 0); } /* -- cgit v1.1