void
mac_labelzone_init(void)
{
-
zone_label = zinit(sizeof(struct label),
8192 * sizeof(struct label),
sizeof(struct label), "MAC Labels");
{
struct label *l;
- if (flags & MAC_NOWAIT)
+ if (flags & MAC_NOWAIT) {
l = (struct label *) zalloc_noblock(zone_label);
- else
+ } else {
l = (struct label *) zalloc(zone_label);
- if (l == NULL)
- return (NULL);
+ }
+ if (l == NULL) {
+ return NULL;
+ }
bzero(l, sizeof(struct label));
l->l_flags = MAC_FLAG_INITIALIZED;
- return (l);
+ return l;
}
void
mac_labelzone_free(struct label *l)
{
-
- if (l == NULL)
+ if (l == NULL) {
panic("Free of NULL MAC label\n");
+ }
- if ((l->l_flags & MAC_FLAG_INITIALIZED) == 0)
+ if ((l->l_flags & MAC_FLAG_INITIALIZED) == 0) {
panic("Free of uninitialized label\n");
+ }
bzero(l, sizeof(struct label));
zfree(zone_label, l);
}
{
KASSERT(l != NULL, ("mac_label_get: NULL label"));
- return ((intptr_t) (l->l_perpolicy[slot].l_ptr));
+ return (intptr_t) (l->l_perpolicy[slot].l_ptr);
}
void
l->l_perpolicy[slot].l_ptr = (void *) v;
}
-