diff mbox

[1/4] selinux: Minor cleanups

Message ID 1478812710-17190-2-git-send-email-agruenba@redhat.com (mailing list archive)
State Accepted
Headers show

Commit Message

Andreas Gruenbacher Nov. 10, 2016, 9:18 p.m. UTC
Fix the comment for function __inode_security_revalidate, which returns
an integer.

Use the LABEL_* constants consistently for isec->initialized.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 security/selinux/hooks.c     | 3 ++-
 security/selinux/selinuxfs.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Paul Moore Nov. 14, 2016, 8:28 p.m. UTC | #1
On Thu, Nov 10, 2016 at 4:18 PM, Andreas Gruenbacher
<agruenba@redhat.com> wrote:
> Fix the comment for function __inode_security_revalidate, which returns
> an integer.
>
> Use the LABEL_* constants consistently for isec->initialized.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>  security/selinux/hooks.c     | 3 ++-
>  security/selinux/selinuxfs.c | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)

Applied, thanks.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 09fd610..b98ab2a 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -237,6 +237,7 @@ static int inode_alloc_security(struct inode *inode)
>         isec->sid = SECINITSID_UNLABELED;
>         isec->sclass = SECCLASS_FILE;
>         isec->task_sid = sid;
> +       isec->initialized = LABEL_INVALID;
>         inode->i_security = isec;
>
>         return 0;
> @@ -247,7 +248,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>  /*
>   * Try reloading inode security labels that have been marked as invalid.  The
>   * @may_sleep parameter indicates when sleeping and thus reloading labels is
> - * allowed; when set to false, returns ERR_PTR(-ECHILD) when the label is
> + * allowed; when set to false, returns -ECHILD when the label is
>   * invalid.  The @opt_dentry parameter should be set to a dentry of the inode;
>   * when no dentry is available, set it to NULL instead.
>   */
> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index 72c145d..50fca20 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c
> @@ -1301,7 +1301,7 @@ static int sel_make_bools(void)
>                         goto out;
>
>                 isec->sid = sid;
> -               isec->initialized = 1;
> +               isec->initialized = LABEL_INITIALIZED;
>                 inode->i_fop = &sel_bool_ops;
>                 inode->i_ino = i|SEL_BOOL_INO_OFFSET;
>                 d_add(dentry, inode);
> @@ -1834,7 +1834,7 @@ static int sel_fill_super(struct super_block *sb, void *data, int silent)
>         isec = (struct inode_security_struct *)inode->i_security;
>         isec->sid = SECINITSID_DEVNULL;
>         isec->sclass = SECCLASS_CHR_FILE;
> -       isec->initialized = 1;
> +       isec->initialized = LABEL_INITIALIZED;
>
>         init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO, MKDEV(MEM_MAJOR, 3));
>         d_add(dentry, inode);
> --
> 2.7.4
>
diff mbox

Patch

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 09fd610..b98ab2a 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -237,6 +237,7 @@  static int inode_alloc_security(struct inode *inode)
 	isec->sid = SECINITSID_UNLABELED;
 	isec->sclass = SECCLASS_FILE;
 	isec->task_sid = sid;
+	isec->initialized = LABEL_INVALID;
 	inode->i_security = isec;
 
 	return 0;
@@ -247,7 +248,7 @@  static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
 /*
  * Try reloading inode security labels that have been marked as invalid.  The
  * @may_sleep parameter indicates when sleeping and thus reloading labels is
- * allowed; when set to false, returns ERR_PTR(-ECHILD) when the label is
+ * allowed; when set to false, returns -ECHILD when the label is
  * invalid.  The @opt_dentry parameter should be set to a dentry of the inode;
  * when no dentry is available, set it to NULL instead.
  */
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 72c145d..50fca20 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1301,7 +1301,7 @@  static int sel_make_bools(void)
 			goto out;
 
 		isec->sid = sid;
-		isec->initialized = 1;
+		isec->initialized = LABEL_INITIALIZED;
 		inode->i_fop = &sel_bool_ops;
 		inode->i_ino = i|SEL_BOOL_INO_OFFSET;
 		d_add(dentry, inode);
@@ -1834,7 +1834,7 @@  static int sel_fill_super(struct super_block *sb, void *data, int silent)
 	isec = (struct inode_security_struct *)inode->i_security;
 	isec->sid = SECINITSID_DEVNULL;
 	isec->sclass = SECCLASS_CHR_FILE;
-	isec->initialized = 1;
+	isec->initialized = LABEL_INITIALIZED;
 
 	init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO, MKDEV(MEM_MAJOR, 3));
 	d_add(dentry, inode);