Lines Matching +full:sens +full:-

1 /* SPDX-License-Identifier: GPL-2.0 */
6 * externally represented as variable-length strings
39 memset(&c->range, 0, sizeof(c->range)); in mls_context_init()
47 dst->range.level[0].sens = src->range.level[0].sens; in mls_context_cpy()
48 rc = ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[0].cat); in mls_context_cpy()
52 dst->range.level[1].sens = src->range.level[1].sens; in mls_context_cpy()
53 rc = ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[1].cat); in mls_context_cpy()
55 ebitmap_destroy(&dst->range.level[0].cat); in mls_context_cpy()
68 dst->range.level[0].sens = src->range.level[0].sens; in mls_context_cpy_low()
69 rc = ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[0].cat); in mls_context_cpy_low()
73 dst->range.level[1].sens = src->range.level[0].sens; in mls_context_cpy_low()
74 rc = ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[0].cat); in mls_context_cpy_low()
76 ebitmap_destroy(&dst->range.level[0].cat); in mls_context_cpy_low()
89 dst->range.level[0].sens = src->range.level[1].sens; in mls_context_cpy_high()
90 rc = ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[1].cat); in mls_context_cpy_high()
94 dst->range.level[1].sens = src->range.level[1].sens; in mls_context_cpy_high()
95 rc = ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[1].cat); in mls_context_cpy_high()
97 ebitmap_destroy(&dst->range.level[0].cat); in mls_context_cpy_high()
106 struct mls_range *dr = &dst->range; in mls_context_glblub()
107 const struct mls_range *r1 = &c1->range, *r2 = &c2->range; in mls_context_glblub()
110 if (r1->level[1].sens < r2->level[0].sens || in mls_context_glblub()
111 r2->level[1].sens < r1->level[0].sens) in mls_context_glblub()
113 return -EINVAL; in mls_context_glblub()
116 dr->level[0].sens = max(r1->level[0].sens, r2->level[0].sens); in mls_context_glblub()
119 dr->level[1].sens = min(r1->level[1].sens, r2->level[1].sens); in mls_context_glblub()
121 rc = ebitmap_and(&dr->level[0].cat, &r1->level[0].cat, in mls_context_glblub()
122 &r2->level[0].cat); in mls_context_glblub()
126 rc = ebitmap_and(&dr->level[1].cat, &r1->level[1].cat, in mls_context_glblub()
127 &r2->level[1].cat); in mls_context_glblub()
138 return ((c1->range.level[0].sens == c2->range.level[0].sens) && in mls_context_cmp()
139 ebitmap_cmp(&c1->range.level[0].cat, &c2->range.level[0].cat) && in mls_context_cmp()
140 (c1->range.level[1].sens == c2->range.level[1].sens) && in mls_context_cmp()
141 ebitmap_cmp(&c1->range.level[1].cat, &c2->range.level[1].cat)); in mls_context_cmp()
146 ebitmap_destroy(&c->range.level[0].cat); in mls_context_destroy()
147 ebitmap_destroy(&c->range.level[1].cat); in mls_context_destroy()
160 dst->user = src->user; in context_cpy()
161 dst->role = src->role; in context_cpy()
162 dst->type = src->type; in context_cpy()
163 if (src->str) { in context_cpy()
164 dst->str = kstrdup(src->str, GFP_ATOMIC); in context_cpy()
165 if (!dst->str) in context_cpy()
166 return -ENOMEM; in context_cpy()
167 dst->len = src->len; in context_cpy()
169 dst->str = NULL; in context_cpy()
170 dst->len = 0; in context_cpy()
174 kfree(dst->str); in context_cpy()
175 dst->str = NULL; in context_cpy()
176 dst->len = 0; in context_cpy()
184 c->user = c->role = c->type = 0; in context_destroy()
185 kfree(c->str); in context_destroy()
186 c->str = NULL; in context_destroy()
187 c->len = 0; in context_destroy()
194 if (c1->len && c2->len) in context_cmp()
195 return (c1->len == c2->len && !strcmp(c1->str, c2->str)); in context_cmp()
196 if (c1->len || c2->len) in context_cmp()
198 return ((c1->user == c2->user) && (c1->role == c2->role) && in context_cmp()
199 (c1->type == c2->type) && mls_context_cmp(c1, c2)); in context_cmp()