Re: [PATCH 24/25] security: Use bool function return values of true/false not 1/0

2015-03-30 Thread John Johansen
On 03/30/2015 04:46 PM, Joe Perches wrote:
> Use the normal return values for bool functions
> 
> Signed-off-by: Joe Perches 
Joe, I'll pull this into my tree and send it up with a couple of other
patches I have pending

Acked-by: John Johansen 

> ---
>  security/apparmor/file.c   |  8 
>  security/apparmor/policy.c | 10 +-
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/security/apparmor/file.c b/security/apparmor/file.c
> index fdaa50c..bd804d4 100644
> --- a/security/apparmor/file.c
> +++ b/security/apparmor/file.c
> @@ -260,8 +260,8 @@ unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned 
> int start,
>  static inline bool is_deleted(struct dentry *dentry)
>  {
>   if (d_unlinked(dentry) && dentry->d_inode->i_nlink == 0)
> - return 1;
> - return 0;
> + return true;
> + return false;
>  }
>  
>  /**
> @@ -322,9 +322,9 @@ static inline bool xindex_is_subset(u32 link, u32 target)
>  {
>   if (((link & ~AA_X_UNSAFE) != (target & ~AA_X_UNSAFE)) ||
>   ((link & AA_X_UNSAFE) && !(target & AA_X_UNSAFE)))
> - return 0;
> + return false;
>  
> - return 1;
> + return true;
>  }
>  
>  /**
> diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
> index 705c287..a8e0177 100644
> --- a/security/apparmor/policy.c
> +++ b/security/apparmor/policy.c
> @@ -137,13 +137,13 @@ static bool policy_init(struct aa_policy *policy, const 
> char *prefix,
>   } else
>   policy->hname = kstrdup(name, GFP_KERNEL);
>   if (!policy->hname)
> - return 0;
> + return false;
>   /* base.name is a substring of fqname */
>   policy->name = (char *)hname_tail(policy->hname);
>   INIT_LIST_HEAD(&policy->list);
>   INIT_LIST_HEAD(&policy->profiles);
>  
> - return 1;
> + return true;
>  }
>  
>  /**
> @@ -927,15 +927,15 @@ bool aa_may_manage_policy(int op)
>   /* check if loading policy is locked out */
>   if (aa_g_lock_policy) {
>   audit_policy(op, GFP_KERNEL, NULL, "policy_locked", -EACCES);
> - return 0;
> + return false;
>   }
>  
>   if (!capable(CAP_MAC_ADMIN)) {
>   audit_policy(op, GFP_KERNEL, NULL, "not policy admin", -EACCES);
> - return 0;
> + return false;
>   }
>  
> - return 1;
> + return true;
>  }
>  
>  static struct aa_profile *__list_lookup_parent(struct list_head *lh,
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 24/25] security: Use bool function return values of true/false not 1/0

2015-03-30 Thread Joe Perches
Use the normal return values for bool functions

Signed-off-by: Joe Perches 
---
 security/apparmor/file.c   |  8 
 security/apparmor/policy.c | 10 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/security/apparmor/file.c b/security/apparmor/file.c
index fdaa50c..bd804d4 100644
--- a/security/apparmor/file.c
+++ b/security/apparmor/file.c
@@ -260,8 +260,8 @@ unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned int 
start,
 static inline bool is_deleted(struct dentry *dentry)
 {
if (d_unlinked(dentry) && dentry->d_inode->i_nlink == 0)
-   return 1;
-   return 0;
+   return true;
+   return false;
 }
 
 /**
@@ -322,9 +322,9 @@ static inline bool xindex_is_subset(u32 link, u32 target)
 {
if (((link & ~AA_X_UNSAFE) != (target & ~AA_X_UNSAFE)) ||
((link & AA_X_UNSAFE) && !(target & AA_X_UNSAFE)))
-   return 0;
+   return false;
 
-   return 1;
+   return true;
 }
 
 /**
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 705c287..a8e0177 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -137,13 +137,13 @@ static bool policy_init(struct aa_policy *policy, const 
char *prefix,
} else
policy->hname = kstrdup(name, GFP_KERNEL);
if (!policy->hname)
-   return 0;
+   return false;
/* base.name is a substring of fqname */
policy->name = (char *)hname_tail(policy->hname);
INIT_LIST_HEAD(&policy->list);
INIT_LIST_HEAD(&policy->profiles);
 
-   return 1;
+   return true;
 }
 
 /**
@@ -927,15 +927,15 @@ bool aa_may_manage_policy(int op)
/* check if loading policy is locked out */
if (aa_g_lock_policy) {
audit_policy(op, GFP_KERNEL, NULL, "policy_locked", -EACCES);
-   return 0;
+   return false;
}
 
if (!capable(CAP_MAC_ADMIN)) {
audit_policy(op, GFP_KERNEL, NULL, "not policy admin", -EACCES);
-   return 0;
+   return false;
}
 
-   return 1;
+   return true;
 }
 
 static struct aa_profile *__list_lookup_parent(struct list_head *lh,
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/