Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d55a345 authored by Eric Paris's avatar Eric Paris Committed by James Morris
Browse files

SELinux: services.c whitespace, syntax, and static declaraction cleanups



This patch changes services.c to fix whitespace and syntax issues.  Things that
are fixed may include (does not not have to include)

whitespace at end of lines
spaces followed by tabs
spaces used instead of tabs
spacing around parenthesis
locateion of { around struct and else clauses
location of * in pointer declarations
removal of initialization of static data to keep it in the right section
useless {} in if statemetns
useless checking for NULL before kfree
fixing of the indentation depth of switch statements
and any number of other things I forgot to mention

Signed-off-by: default avatarEric Paris <eparis@redhat.com>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 1a5e6f87
Loading
Loading
Loading
Loading
+55 −60
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@ static DEFINE_MUTEX(load_mutex);


static struct sidtab sidtab;
static struct sidtab sidtab;
struct policydb policydb;
struct policydb policydb;
int ss_initialized = 0;
int ss_initialized;


/*
/*
 * The largest sequence number that has been used when
 * The largest sequence number that has been used when
@@ -90,7 +90,7 @@ int ss_initialized = 0;
 * The sequence number only changes when a policy change
 * The sequence number only changes when a policy change
 * occurs.
 * occurs.
 */
 */
static u32 latest_granting = 0;
static u32 latest_granting;


/* Forward declaration. */
/* Forward declaration. */
static int context_struct_to_string(struct context *context, char **scontext,
static int context_struct_to_string(struct context *context, char **scontext,
@@ -623,9 +623,8 @@ static int context_struct_to_string(struct context *context, char **scontext, u3


	/* Allocate space for the context; caller must free this space. */
	/* Allocate space for the context; caller must free this space. */
	scontextp = kmalloc(*scontext_len, GFP_ATOMIC);
	scontextp = kmalloc(*scontext_len, GFP_ATOMIC);
	if (!scontextp) {
	if (!scontextp)
		return -ENOMEM;
		return -ENOMEM;
	}
	*scontext = scontextp;
	*scontext = scontextp;


	/*
	/*
@@ -1289,25 +1288,22 @@ static int convert_context(u32 key,
	/* Convert the user. */
	/* Convert the user. */
	usrdatum = hashtab_search(args->newp->p_users.table,
	usrdatum = hashtab_search(args->newp->p_users.table,
				  args->oldp->p_user_val_to_name[c->user - 1]);
				  args->oldp->p_user_val_to_name[c->user - 1]);
	if (!usrdatum) {
	if (!usrdatum)
		goto bad;
		goto bad;
	}
	c->user = usrdatum->value;
	c->user = usrdatum->value;


	/* Convert the role. */
	/* Convert the role. */
	role = hashtab_search(args->newp->p_roles.table,
	role = hashtab_search(args->newp->p_roles.table,
			      args->oldp->p_role_val_to_name[c->role - 1]);
			      args->oldp->p_role_val_to_name[c->role - 1]);
	if (!role) {
	if (!role)
		goto bad;
		goto bad;
	}
	c->role = role->value;
	c->role = role->value;


	/* Convert the type. */
	/* Convert the type. */
	typdatum = hashtab_search(args->newp->p_types.table,
	typdatum = hashtab_search(args->newp->p_types.table,
				  args->oldp->p_type_val_to_name[c->type - 1]);
				  args->oldp->p_type_val_to_name[c->type - 1]);
	if (!typdatum) {
	if (!typdatum)
		goto bad;
		goto bad;
	}
	c->type = typdatum->value;
	c->type = typdatum->value;


	rc = mls_convert_context(args->oldp, args->newp, c);
	rc = mls_convert_context(args->oldp, args->newp, c);
@@ -1938,12 +1934,11 @@ int security_set_bools(int len, int *values)
				audit_get_loginuid(current),
				audit_get_loginuid(current),
				audit_get_sessionid(current));
				audit_get_sessionid(current));
		}
		}
		if (values[i]) {
		if (values[i])
			policydb.bool_val_to_struct[i]->state = 1;
			policydb.bool_val_to_struct[i]->state = 1;
		} else {
		else
			policydb.bool_val_to_struct[i]->state = 0;
			policydb.bool_val_to_struct[i]->state = 0;
	}
	}
	}


	for (cur = policydb.cond_list; cur != NULL; cur = cur->next) {
	for (cur = policydb.cond_list; cur != NULL; cur = cur->next) {
		rc = evaluate_cond_node(&policydb, cur);
		rc = evaluate_cond_node(&policydb, cur);