All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ima: cleanup ima_init_policy() a little
@ 2015-04-07  9:22 Dan Carpenter
  2015-04-07 13:22 ` Mimi Zohar
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-04-07  9:22 UTC (permalink / raw)
  To: kernel-janitors

It's a bit easier to read this if we split it up into two for loops.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index d1eefb9..e86b58d 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -338,16 +338,12 @@ void __init ima_init_policy(void)
 	appraise_entries = ima_use_appraise_tcb ?
 			 ARRAY_SIZE(default_appraise_rules) : 0;
 
-	for (i = 0; i < measure_entries + appraise_entries; i++) {
-		if (i < measure_entries)
-			list_add_tail(&default_rules[i].list,
-				      &ima_default_rules);
-		else {
-			int j = i - measure_entries;
-
-			list_add_tail(&default_appraise_rules[j].list,
-				      &ima_default_rules);
-		}
+	for (i = 0; i < measure_entries; i++)
+		list_add_tail(&default_rules[i].list, &ima_default_rules);
+
+	for (i = 0; i < appraise_entries; i++) {
+		list_add_tail(&default_appraise_rules[i].list,
+			      &ima_default_rules);
 	}
 
 	ima_rules = &ima_default_rules;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] ima: cleanup ima_init_policy() a little
  2015-04-07  9:22 [patch] ima: cleanup ima_init_policy() a little Dan Carpenter
@ 2015-04-07 13:22 ` Mimi Zohar
  0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2015-04-07 13:22 UTC (permalink / raw)
  To: kernel-janitors

On Tue, 2015-04-07 at 12:22 +0300, Dan Carpenter wrote: 
> It's a bit easier to read this if we split it up into two for loops.

Agreed

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> 

Mimi

> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index d1eefb9..e86b58d 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -338,16 +338,12 @@ void __init ima_init_policy(void)
>  	appraise_entries = ima_use_appraise_tcb ?
>  			 ARRAY_SIZE(default_appraise_rules) : 0;
> 
> -	for (i = 0; i < measure_entries + appraise_entries; i++) {
> -		if (i < measure_entries)
> -			list_add_tail(&default_rules[i].list,
> -				      &ima_default_rules);
> -		else {
> -			int j = i - measure_entries;
> -
> -			list_add_tail(&default_appraise_rules[j].list,
> -				      &ima_default_rules);
> -		}
> +	for (i = 0; i < measure_entries; i++)
> +		list_add_tail(&default_rules[i].list, &ima_default_rules);
> +
> +	for (i = 0; i < appraise_entries; i++) {
> +		list_add_tail(&default_appraise_rules[i].list,
> +			      &ima_default_rules);
>  	}
> 
>  	ima_rules = &ima_default_rules;



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-07 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-07  9:22 [patch] ima: cleanup ima_init_policy() a little Dan Carpenter
2015-04-07 13:22 ` Mimi Zohar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.