Commit c266f974 authored by Daniel P. Smith's avatar Daniel P. Smith Committed by Jan Beulich

xsm/flask: code style formatting

This is a quick code style cleanup patch for xsm/flask. The files flask_op.c
and hooks.c are Xen specific, thus full code style rules were applied. The
remaining files are from Linux and therefore only trailing whitespace was
remove from those files.
Signed-off-by: default avatarDaniel P. Smith <dpsmith@apertussolutions.com>
Acked-by: default avatarAndrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: default avatarJason Andryuk <jandryuk@gmail.com>
parent fa4d84e6
......@@ -13,9 +13,9 @@
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*/
/* Ported to Xen 3.0, George Coker, <gscoker@alpha.ncsc.mil> */
#include <xen/lib.h>
#include <xen/xmalloc.h>
#include <xen/types.h>
......@@ -267,7 +267,7 @@ int avc_get_hash_stats(struct xen_flask_hash_stats *arg)
}
rcu_read_unlock(&avc_rcu_lock);
arg->entries = atomic_read(&avc_cache.active_nodes);
arg->buckets_used = slots_used;
arg->buckets_total = AVC_CACHE_SLOTS;
......@@ -336,7 +336,7 @@ static inline int avc_reclaim_node(void)
}
rcu_read_unlock(&avc_rcu_lock);
spin_unlock_irqrestore(lock, flags);
}
}
out:
return ecx;
}
......@@ -622,7 +622,7 @@ static int avc_update_node(u32 perms, u32 ssid, u32 tsid, u16 tclass,
struct hlist_head *head;
struct hlist_node *next;
spinlock_t *lock;
node = avc_alloc_node();
if ( !node )
{
......@@ -630,7 +630,7 @@ static int avc_update_node(u32 perms, u32 ssid, u32 tsid, u16 tclass,
goto out;
}
hvalue = avc_hash(ssid, tsid, tclass);
hvalue = avc_hash(ssid, tsid, tclass);
head = &avc_cache.slots[hvalue];
lock = &avc_cache.slots_lock[hvalue];
......@@ -695,7 +695,7 @@ int avc_ss_reset(u32 seqno)
rcu_read_unlock(&avc_rcu_lock);
spin_unlock_irqrestore(lock, flag);
}
avc_latest_notif_update(seqno, 0);
return rc;
}
......
......@@ -75,15 +75,15 @@ static int __init cf_check parse_flask_param(const char *s)
}
custom_param("flask", parse_flask_param);
static int domain_has_security(struct domain *d, u32 perms)
static int domain_has_security(struct domain *d, uint32_t perms)
{
struct domain_security_struct *dsec;
dsec = d->ssid;
if ( !dsec )
return -EACCES;
return avc_has_perm(dsec->sid, SECINITSID_SECURITY, SECCLASS_SECURITY,
return avc_has_perm(dsec->sid, SECINITSID_SECURITY, SECCLASS_SECURITY,
perms, NULL);
}
......@@ -130,7 +130,7 @@ static int flask_security_access(struct xen_flask_access *arg)
arg->audit_allow = avd.auditallow;
arg->audit_deny = avd.auditdeny;
arg->seqno = avd.seqno;
return rv;
}
......@@ -196,7 +196,7 @@ static int flask_security_sid(struct xen_flask_sid_context *arg)
{
int rv;
char *context;
u32 len;
uint32_t len;
rv = domain_has_security(current->domain, SECURITY__CHECK_CONTEXT);
if ( rv )
......@@ -223,7 +223,8 @@ static int flask_security_sid(struct xen_flask_sid_context *arg)
#ifndef COMPAT
static int flask_security_setavc_threshold(struct xen_flask_setavc_threshold *arg)
static int flask_security_setavc_threshold(
struct xen_flask_setavc_threshold *arg)
{
int rv = 0;
......@@ -350,7 +351,7 @@ static int flask_security_get_bool(struct xen_flask_boolean *arg)
if ( nameout_len > arg->size )
rv = -ERANGE;
arg->size = nameout_len;
if ( !rv && _copy_to_guest(arg->name, nameout, nameout_len) )
rv = -EFAULT;
xfree(nameout);
......@@ -386,9 +387,9 @@ static int flask_security_make_bools(void)
int ret = 0;
int num;
int *values = NULL;
xfree(bool_pending_values);
ret = security_get_bools(&num, NULL, &values, NULL);
if ( ret != 0 )
goto out;
......@@ -474,8 +475,8 @@ static int flask_devicetree_label(struct xen_flask_devicetree_label *arg)
{
int rv;
char *buf;
u32 sid = arg->sid;
u32 perm = sid ? SECURITY__ADD_OCONTEXT : SECURITY__DEL_OCONTEXT;
uint32_t sid = arg->sid;
uint32_t perm = sid ? SECURITY__ADD_OCONTEXT : SECURITY__DEL_OCONTEXT;
rv = domain_has_security(current->domain, perm);
if ( rv )
......@@ -670,7 +671,7 @@ ret_t cf_check do_flask_op(XEN_GUEST_HANDLE_PARAM(void) u_flask_op)
case FLASK_MLS:
rv = flask_mls_enabled;
break;
break;
case FLASK_GETAVC_THRESHOLD:
rv = avc_cache_threshold;
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
*
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
*/
/* Ported to Xen 3.0, George Coker, <gscoker@alpha.ncsc.mil> */
#ifndef _FLASK_AVC_H_
......
......@@ -35,7 +35,7 @@ static inline int avtab_hash(struct avtab_key *keyp, u16 mask)
}
static struct avtab_node* avtab_insert_node(struct avtab *h, int hvalue,
struct avtab_node * prev, struct avtab_node * cur, struct avtab_key *key,
struct avtab_node * prev, struct avtab_node * cur, struct avtab_key *key,
struct avtab_datum *datum)
{
struct avtab_node *newnode = xzalloc(struct avtab_node);
......@@ -59,7 +59,7 @@ static struct avtab_node* avtab_insert_node(struct avtab *h, int hvalue,
return newnode;
}
static int avtab_insert(struct avtab *h, struct avtab_key *key,
static int avtab_insert(struct avtab *h, struct avtab_key *key,
struct avtab_datum *datum)
{
int hvalue;
......@@ -100,7 +100,7 @@ static int avtab_insert(struct avtab *h, struct avtab_key *key,
* key/specified mask into the table, as needed by the conditional avtab.
* It also returns a pointer to the node inserted.
*/
struct avtab_node * avtab_insert_nonunique(struct avtab * h,
struct avtab_node * avtab_insert_nonunique(struct avtab * h,
struct avtab_key * key, struct avtab_datum * datum)
{
int hvalue;
......@@ -110,7 +110,7 @@ struct avtab_node * avtab_insert_nonunique(struct avtab * h,
if ( !h || !h->htable )
return NULL;
hvalue = avtab_hash(key, h->mask);
for ( prev = NULL, cur = h->htable[hvalue]; cur;
for ( prev = NULL, cur = h->htable[hvalue]; cur;
prev = cur, cur = cur->next )
{
if ( key->source_type == cur->key.source_type &&
......@@ -199,7 +199,7 @@ struct avtab_node* avtab_search_node(struct avtab *h, struct avtab_key *key)
return NULL;
}
struct avtab_node* avtab_search_node_next(struct avtab_node *node,
struct avtab_node* avtab_search_node_next(struct avtab_node *node,
int specified)
{
struct avtab_node *cur;
......
......@@ -74,12 +74,12 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
int avtab_read(struct avtab *a, void *fp, struct policydb *pol);
struct avtab_node *avtab_insert_nonunique(struct avtab *h,
struct avtab_node *avtab_insert_nonunique(struct avtab *h,
struct avtab_key *key, struct avtab_datum *datum);
struct avtab_node *avtab_search_node(struct avtab *h, struct avtab_key *key);
struct avtab_node *avtab_search_node_next(struct avtab_node *node,
struct avtab_node *avtab_search_node_next(struct avtab_node *node,
int specified);
#define MAX_AVTAB_HASH_BITS 13
......
......@@ -452,7 +452,7 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
goto err;
}
if ( i == 0 )
if ( i == 0 )
node->expr = expr;
else
last->next = expr;
......@@ -513,7 +513,7 @@ err:
/* Determine whether additional permissions are granted by the conditional
* av table, and if so, add them to the result
*/
void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
struct av_decision *avd)
{
struct avtab_node *node;
......
......@@ -12,9 +12,9 @@
*
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
*/
/* Ported to Xen 3.0, George Coker, <gscoker@alpha.ncsc.mil> */
#ifndef _SS_CONTEXT_H_
#define _SS_CONTEXT_H_
......
......@@ -70,7 +70,7 @@ int mls_compute_context_len(struct context * context)
}
if ( l == 0 )
{
if ( mls_level_eq(&context->range.level[0],
if ( mls_level_eq(&context->range.level[0],
&context->range.level[1]) )
break;
else
......
......@@ -339,7 +339,7 @@ static int cf_check sens_index(void *key, void *datum, void *datap)
if ( !levdatum->isalias )
{
if ( !levdatum->level->sens || levdatum->level->sens >
if ( !levdatum->level->sens || levdatum->level->sens >
p->p_levels.nprim )
return -EINVAL;
p->p_sens_val_to_name[levdatum->level->sens - 1] = key;
......
......@@ -99,7 +99,7 @@ static int context_struct_compute_av(struct context *scontext,
* constraint_expr_eval should pass in NULL for xcontext.
*/
static int constraint_expr_eval(struct context *scontext,
struct context *tcontext, struct context *xcontext,
struct context *tcontext, struct context *xcontext,
struct constraint_expr *cexpr)
{
u32 val1, val2;
......@@ -1073,7 +1073,7 @@ static int security_compute_sid(u32 ssid,
/* Look for a role transition rule. */
for ( roletr = policydb.role_tr; roletr; roletr = roletr->next )
{
if ( roletr->role == scontext->role &&
if ( roletr->role == scontext->role &&
roletr->type == tcontext->type )
{
/* Use the role transition rule. */
......@@ -1485,7 +1485,7 @@ int security_irq_sid(int pirq, u32 *out_sid)
POLICY_RDLOCK;
c = policydb.ocontexts[OCON_PIRQ];
while ( c )
{
if ( c->u.pirq == pirq )
......
......@@ -3,9 +3,9 @@
*
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
*/
/* Ported to Xen 3.0, George Coker, <gscoker@alpha.ncsc.mil> */
#include <xen/lib.h>
#include <xen/xmalloc.h>
#include <xen/errno.h>
......@@ -192,7 +192,7 @@ void sidtab_map_remove_on_error(struct sidtab *s,
return;
}
static inline u32 sidtab_search_context(struct sidtab *s,
static inline u32 sidtab_search_context(struct sidtab *s,
struct context *context)
{
int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment