selinux: Cleanup printk logging in conditional

Replace printk with pr_* to avoid checkpatch warnings.

Signed-off-by: Peter Enderborg <peter.enderborg@sony.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
This commit is contained in:
peter enderborg 2018-06-12 10:09:00 +02:00 коммит произвёл Paul Moore
Родитель cf76e1e519
Коммит ab48576c42
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -96,7 +96,7 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
if (new_state != node->cur_state) { if (new_state != node->cur_state) {
node->cur_state = new_state; node->cur_state = new_state;
if (new_state == -1) if (new_state == -1)
printk(KERN_ERR "SELinux: expression result was undefined - disabling all rules.\n"); pr_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; cur = cur->next) { for (cur = node->true_list; cur; cur = cur->next) {
if (new_state <= 0) if (new_state <= 0)
@ -287,7 +287,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
*/ */
if (k->specified & AVTAB_TYPE) { if (k->specified & AVTAB_TYPE) {
if (avtab_search(&p->te_avtab, k)) { if (avtab_search(&p->te_avtab, k)) {
printk(KERN_ERR "SELinux: type rule already exists outside of a conditional.\n"); pr_err("SELinux: type rule already exists outside of a conditional.\n");
goto err; goto err;
} }
/* /*
@ -302,7 +302,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
node_ptr = avtab_search_node(&p->te_cond_avtab, k); node_ptr = avtab_search_node(&p->te_cond_avtab, k);
if (node_ptr) { if (node_ptr) {
if (avtab_search_node_next(node_ptr, k->specified)) { if (avtab_search_node_next(node_ptr, k->specified)) {
printk(KERN_ERR "SELinux: too many conflicting type rules.\n"); pr_err("SELinux: too many conflicting type rules.\n");
goto err; goto err;
} }
found = 0; found = 0;
@ -313,13 +313,13 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
} }
} }
if (!found) { if (!found) {
printk(KERN_ERR "SELinux: conflicting type rules.\n"); pr_err("SELinux: conflicting type rules.\n");
goto err; goto err;
} }
} }
} else { } else {
if (avtab_search(&p->te_cond_avtab, k)) { if (avtab_search(&p->te_cond_avtab, k)) {
printk(KERN_ERR "SELinux: conflicting type rules when adding type rule for true.\n"); pr_err("SELinux: conflicting type rules when adding type rule for true.\n");
goto err; goto err;
} }
} }
@ -327,7 +327,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
node_ptr = avtab_insert_nonunique(&p->te_cond_avtab, k, d); node_ptr = avtab_insert_nonunique(&p->te_cond_avtab, k, d);
if (!node_ptr) { if (!node_ptr) {
printk(KERN_ERR "SELinux: could not insert rule.\n"); pr_err("SELinux: could not insert rule.\n");
rc = -ENOMEM; rc = -ENOMEM;
goto err; goto err;
} }
@ -387,12 +387,12 @@ static int cond_read_av_list(struct policydb *p, void *fp, struct cond_av_list *
static int expr_isvalid(struct policydb *p, struct cond_expr *expr) static int expr_isvalid(struct policydb *p, struct cond_expr *expr)
{ {
if (expr->expr_type <= 0 || expr->expr_type > COND_LAST) { if (expr->expr_type <= 0 || expr->expr_type > COND_LAST) {
printk(KERN_ERR "SELinux: conditional expressions uses unknown operator.\n"); pr_err("SELinux: conditional expressions uses unknown operator.\n");
return 0; return 0;
} }
if (expr->bool > p->p_bools.nprim) { if (expr->bool > p->p_bools.nprim) {
printk(KERN_ERR "SELinux: conditional expressions uses unknown bool.\n"); pr_err("SELinux: conditional expressions uses unknown bool.\n");
return 0; return 0;
} }
return 1; return 1;