Skip to content

Commit 4afec36

Browse files
committed
selinux: fix style issues in security/selinux/ss/mls.c
As part of on ongoing effort to perform more automated testing and provide more tools for individual developers to validate their patches before submitting, we are trying to make our code "clang-format clean". My hope is that once we have fixed all of our style "quirks", developers will be able to run clang-format on their patches to help avoid silly formatting problems and ensure their changes fit in well with the rest of the SELinux kernel code. Signed-off-by: Paul Moore <[email protected]>
1 parent 470948b commit 4afec36

File tree

1 file changed

+33
-50
lines changed

1 file changed

+33
-50
lines changed

security/selinux/ss/mls.c

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44
*
55
* Author : Stephen Smalley, <[email protected]>
66
*/
7+
78
/*
89
* Updated: Trusted Computer Solutions, Inc. <[email protected]>
10+
* Support for enhanced MLS infrastructure.
11+
* Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
912
*
10-
* Support for enhanced MLS infrastructure.
11-
*
12-
* Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
13-
*/
14-
/*
1513
* Updated: Hewlett-Packard <[email protected]>
16-
*
17-
* Added support to import/export the MLS label from NetLabel
18-
*
19-
* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
14+
* Added support to import/export the MLS label from NetLabel
15+
* Copyright (C) Hewlett-Packard Development Company, L.P., 2006
2016
*/
2117

2218
#include <linux/kernel.h>
@@ -52,7 +48,8 @@ int mls_compute_context_len(struct policydb *p, struct context *context)
5248
head = -2;
5349
prev = -2;
5450
e = &context->range.level[l].cat;
55-
ebitmap_for_each_positive_bit(e, node, i) {
51+
ebitmap_for_each_positive_bit(e, node, i)
52+
{
5653
if (i - prev > 1) {
5754
/* one or more negative bits are skipped */
5855
if (head != prev) {
@@ -86,8 +83,7 @@ int mls_compute_context_len(struct policydb *p, struct context *context)
8683
* the MLS fields of `context' into the string `*scontext'.
8784
* Update `*scontext' to point to the end of the MLS fields.
8885
*/
89-
void mls_sid_to_context(struct policydb *p,
90-
struct context *context,
86+
void mls_sid_to_context(struct policydb *p, struct context *context,
9187
char **scontext)
9288
{
9389
char *scontextp, *nm;
@@ -112,7 +108,8 @@ void mls_sid_to_context(struct policydb *p,
112108
head = -2;
113109
prev = -2;
114110
e = &context->range.level[l].cat;
115-
ebitmap_for_each_positive_bit(e, node, i) {
111+
ebitmap_for_each_positive_bit(e, node, i)
112+
{
116113
if (i - prev > 1) {
117114
/* one or more negative bits are skipped */
118115
if (prev != head) {
@@ -230,12 +227,8 @@ int mls_context_isvalid(struct policydb *p, struct context *c)
230227
* Policy read-lock must be held for sidtab lookup.
231228
*
232229
*/
233-
int mls_context_to_sid(struct policydb *pol,
234-
char oldc,
235-
char *scontext,
236-
struct context *context,
237-
struct sidtab *s,
238-
u32 def_sid)
230+
int mls_context_to_sid(struct policydb *pol, char oldc, char *scontext,
231+
struct context *context, struct sidtab *s, u32 def_sid)
239232
{
240233
char *sensitivity, *cur_cat, *next_cat, *rngptr;
241234
struct level_datum *levdatum;
@@ -333,7 +326,8 @@ int mls_context_to_sid(struct policydb *pol,
333326
return -EINVAL;
334327

335328
for (i = catdatum->value; i < rngdatum->value; i++) {
336-
rc = ebitmap_set_bit(&context->range.level[l].cat, i, 1);
329+
rc = ebitmap_set_bit(
330+
&context->range.level[l].cat, i, 1);
337331
if (rc)
338332
return rc;
339333
}
@@ -371,8 +365,8 @@ int mls_from_string(struct policydb *p, char *str, struct context *context,
371365
if (!tmpstr) {
372366
rc = -ENOMEM;
373367
} else {
374-
rc = mls_context_to_sid(p, ':', tmpstr, context,
375-
NULL, SECSID_NULL);
368+
rc = mls_context_to_sid(p, ':', tmpstr, context, NULL,
369+
SECSID_NULL);
376370
kfree(tmpstr);
377371
}
378372

@@ -382,8 +376,7 @@ int mls_from_string(struct policydb *p, char *str, struct context *context,
382376
/*
383377
* Copies the MLS range `range' into `context'.
384378
*/
385-
int mls_range_set(struct context *context,
386-
struct mls_range *range)
379+
int mls_range_set(struct context *context, struct mls_range *range)
387380
{
388381
int l, rc = 0;
389382

@@ -399,9 +392,8 @@ int mls_range_set(struct context *context,
399392
return rc;
400393
}
401394

402-
int mls_setup_user_range(struct policydb *p,
403-
struct context *fromcon, struct user_datum *user,
404-
struct context *usercon)
395+
int mls_setup_user_range(struct policydb *p, struct context *fromcon,
396+
struct user_datum *user, struct context *usercon)
405397
{
406398
if (p->mls_enabled) {
407399
struct mls_level *fromcon_sen = &(fromcon->range.level[0]);
@@ -444,10 +436,8 @@ int mls_setup_user_range(struct policydb *p,
444436
* policy `oldp' to the values specified in the policy `newp',
445437
* storing the resulting context in `newc'.
446438
*/
447-
int mls_convert_context(struct policydb *oldp,
448-
struct policydb *newp,
449-
struct context *oldc,
450-
struct context *newc)
439+
int mls_convert_context(struct policydb *oldp, struct policydb *newp,
440+
struct context *oldc, struct context *newc)
451441
{
452442
struct level_datum *levdatum;
453443
struct cat_datum *catdatum;
@@ -468,8 +458,9 @@ int mls_convert_context(struct policydb *oldp,
468458
return -EINVAL;
469459
newc->range.level[l].sens = levdatum->level->sens;
470460

471-
ebitmap_for_each_positive_bit(&oldc->range.level[l].cat,
472-
node, i) {
461+
ebitmap_for_each_positive_bit(&oldc->range.level[l].cat, node,
462+
i)
463+
{
473464
int rc;
474465

475466
catdatum = symtab_search(&newp->p_cats,
@@ -486,13 +477,9 @@ int mls_convert_context(struct policydb *oldp,
486477
return 0;
487478
}
488479

489-
int mls_compute_sid(struct policydb *p,
490-
struct context *scontext,
491-
struct context *tcontext,
492-
u16 tclass,
493-
u32 specified,
494-
struct context *newcontext,
495-
bool sock)
480+
int mls_compute_sid(struct policydb *p, struct context *scontext,
481+
struct context *tcontext, u16 tclass, u32 specified,
482+
struct context *newcontext, bool sock)
496483
{
497484
struct range_trans rtr;
498485
struct mls_range *r;
@@ -532,8 +519,8 @@ int mls_compute_sid(struct policydb *p,
532519
case DEFAULT_TARGET_LOW_HIGH:
533520
return mls_context_cpy(newcontext, tcontext);
534521
case DEFAULT_GLBLUB:
535-
return mls_context_glblub(newcontext,
536-
scontext, tcontext);
522+
return mls_context_glblub(newcontext, scontext,
523+
tcontext);
537524
}
538525

539526
fallthrough;
@@ -563,8 +550,7 @@ int mls_compute_sid(struct policydb *p,
563550
* NetLabel MLS sensitivity level field.
564551
*
565552
*/
566-
void mls_export_netlbl_lvl(struct policydb *p,
567-
struct context *context,
553+
void mls_export_netlbl_lvl(struct policydb *p, struct context *context,
568554
struct netlbl_lsm_secattr *secattr)
569555
{
570556
if (!p->mls_enabled)
@@ -585,8 +571,7 @@ void mls_export_netlbl_lvl(struct policydb *p,
585571
* NetLabel MLS sensitivity level into the context.
586572
*
587573
*/
588-
void mls_import_netlbl_lvl(struct policydb *p,
589-
struct context *context,
574+
void mls_import_netlbl_lvl(struct policydb *p, struct context *context,
590575
struct netlbl_lsm_secattr *secattr)
591576
{
592577
if (!p->mls_enabled)
@@ -607,8 +592,7 @@ void mls_import_netlbl_lvl(struct policydb *p,
607592
* MLS category field. Returns zero on success, negative values on failure.
608593
*
609594
*/
610-
int mls_export_netlbl_cat(struct policydb *p,
611-
struct context *context,
595+
int mls_export_netlbl_cat(struct policydb *p, struct context *context,
612596
struct netlbl_lsm_secattr *secattr)
613597
{
614598
int rc;
@@ -637,8 +621,7 @@ int mls_export_netlbl_cat(struct policydb *p,
637621
* negative values on failure.
638622
*
639623
*/
640-
int mls_import_netlbl_cat(struct policydb *p,
641-
struct context *context,
624+
int mls_import_netlbl_cat(struct policydb *p, struct context *context,
642625
struct netlbl_lsm_secattr *secattr)
643626
{
644627
int rc;

0 commit comments

Comments
 (0)