|
@@ -29,7 +29,7 @@ static int cond_evaluate_expr(struct policydb *p, struct cond_expr *expr)
|
|
int s[COND_EXPR_MAXDEPTH];
|
|
int s[COND_EXPR_MAXDEPTH];
|
|
int sp = -1;
|
|
int sp = -1;
|
|
|
|
|
|
- for (cur = expr; cur != NULL; cur = cur->next) {
|
|
|
|
|
|
+ for (cur = expr; cur; cur = cur->next) {
|
|
switch (cur->expr_type) {
|
|
switch (cur->expr_type) {
|
|
case COND_BOOL:
|
|
case COND_BOOL:
|
|
if (sp == (COND_EXPR_MAXDEPTH - 1))
|
|
if (sp == (COND_EXPR_MAXDEPTH - 1))
|
|
@@ -97,14 +97,14 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
|
|
if (new_state == -1)
|
|
if (new_state == -1)
|
|
printk(KERN_ERR "SELinux: expression result was undefined - disabling all rules.\n");
|
|
printk(KERN_ERR "SELinux: expression result was undefined - disabling all rules.\n");
|
|
/* turn the rules on or off */
|
|
/* turn the rules on or off */
|
|
- for (cur = node->true_list; cur != NULL; cur = cur->next) {
|
|
|
|
|
|
+ for (cur = node->true_list; cur; cur = cur->next) {
|
|
if (new_state <= 0)
|
|
if (new_state <= 0)
|
|
cur->node->key.specified &= ~AVTAB_ENABLED;
|
|
cur->node->key.specified &= ~AVTAB_ENABLED;
|
|
else
|
|
else
|
|
cur->node->key.specified |= AVTAB_ENABLED;
|
|
cur->node->key.specified |= AVTAB_ENABLED;
|
|
}
|
|
}
|
|
|
|
|
|
- for (cur = node->false_list; cur != NULL; cur = cur->next) {
|
|
|
|
|
|
+ for (cur = node->false_list; cur; cur = cur->next) {
|
|
/* -1 or 1 */
|
|
/* -1 or 1 */
|
|
if (new_state)
|
|
if (new_state)
|
|
cur->node->key.specified &= ~AVTAB_ENABLED;
|
|
cur->node->key.specified &= ~AVTAB_ENABLED;
|
|
@@ -128,7 +128,7 @@ int cond_policydb_init(struct policydb *p)
|
|
static void cond_av_list_destroy(struct cond_av_list *list)
|
|
static void cond_av_list_destroy(struct cond_av_list *list)
|
|
{
|
|
{
|
|
struct cond_av_list *cur, *next;
|
|
struct cond_av_list *cur, *next;
|
|
- for (cur = list; cur != NULL; cur = next) {
|
|
|
|
|
|
+ for (cur = list; cur; cur = next) {
|
|
next = cur->next;
|
|
next = cur->next;
|
|
/* the avtab_ptr_t node is destroy by the avtab */
|
|
/* the avtab_ptr_t node is destroy by the avtab */
|
|
kfree(cur);
|
|
kfree(cur);
|
|
@@ -139,7 +139,7 @@ static void cond_node_destroy(struct cond_node *node)
|
|
{
|
|
{
|
|
struct cond_expr *cur_expr, *next_expr;
|
|
struct cond_expr *cur_expr, *next_expr;
|
|
|
|
|
|
- for (cur_expr = node->expr; cur_expr != NULL; cur_expr = next_expr) {
|
|
|
|
|
|
+ for (cur_expr = node->expr; cur_expr; cur_expr = next_expr) {
|
|
next_expr = cur_expr->next;
|
|
next_expr = cur_expr->next;
|
|
kfree(cur_expr);
|
|
kfree(cur_expr);
|
|
}
|
|
}
|
|
@@ -155,7 +155,7 @@ static void cond_list_destroy(struct cond_node *list)
|
|
if (list == NULL)
|
|
if (list == NULL)
|
|
return;
|
|
return;
|
|
|
|
|
|
- for (cur = list; cur != NULL; cur = next) {
|
|
|
|
|
|
+ for (cur = list; cur; cur = next) {
|
|
next = cur->next;
|
|
next = cur->next;
|
|
cond_node_destroy(cur);
|
|
cond_node_destroy(cur);
|
|
}
|
|
}
|
|
@@ -291,7 +291,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
|
|
goto err;
|
|
goto err;
|
|
}
|
|
}
|
|
found = 0;
|
|
found = 0;
|
|
- for (cur = other; cur != NULL; cur = cur->next) {
|
|
|
|
|
|
+ for (cur = other; cur; cur = cur->next) {
|
|
if (cur->node == node_ptr) {
|
|
if (cur->node == node_ptr) {
|
|
found = 1;
|
|
found = 1;
|
|
break;
|
|
break;
|
|
@@ -485,7 +485,7 @@ void cond_compute_av(struct avtab *ctab, struct avtab_key *key, struct av_decisi
|
|
if (!ctab || !key || !avd)
|
|
if (!ctab || !key || !avd)
|
|
return;
|
|
return;
|
|
|
|
|
|
- for (node = avtab_search_node(ctab, key); node != NULL;
|
|
|
|
|
|
+ for (node = avtab_search_node(ctab, key); node;
|
|
node = avtab_search_node_next(node, key->specified)) {
|
|
node = avtab_search_node_next(node, key->specified)) {
|
|
if ((u16)(AVTAB_ALLOWED|AVTAB_ENABLED) ==
|
|
if ((u16)(AVTAB_ALLOWED|AVTAB_ENABLED) ==
|
|
(node->key.specified & (AVTAB_ALLOWED|AVTAB_ENABLED)))
|
|
(node->key.specified & (AVTAB_ALLOWED|AVTAB_ENABLED)))
|