Re: [PATCH 04/13] selinux: Cleanup printk logging in hooks

2018-06-19 Thread Paul Moore
On Tue, Jun 12, 2018 at 4:09 AM Peter Enderborg
 wrote:
>
> Replace printk with pr_* to avoid checkpatch warnings.
>
> Signed-off-by: Peter Enderborg 
> ---
>  security/selinux/hooks.c | 68 
> +++-
>  1 file changed, 33 insertions(+), 35 deletions(-)

Merged, thank you.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 4cafe6a19167..3ab9687ac4c8 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -531,7 +531,7 @@ static int sb_finish_set_opts(struct super_block *sb)
>the first boot of the SELinux kernel before we have
>assigned xattr values to the filesystem. */
> if (!(root_inode->i_opflags & IOP_XATTR)) {
> -   printk(KERN_WARNING "SELinux: (dev %s, type %s) has 
> no "
> +   pr_warn("SELinux: (dev %s, type %s) has no "
>"xattr support\n", sb->s_id, sb->s_type->name);
> rc = -EOPNOTSUPP;
> goto out;
> @@ -540,11 +540,11 @@ static int sb_finish_set_opts(struct super_block *sb)
> rc = __vfs_getxattr(root, root_inode, XATTR_NAME_SELINUX, 
> NULL, 0);
> if (rc < 0 && rc != -ENODATA) {
> if (rc == -EOPNOTSUPP)
> -   printk(KERN_WARNING "SELinux: (dev %s, type "
> +   pr_warn("SELinux: (dev %s, type "
>"%s) has no security xattr handler\n",
>sb->s_id, sb->s_type->name);
> else
> -   printk(KERN_WARNING "SELinux: (dev %s, type "
> +   pr_warn("SELinux: (dev %s, type "
>"%s) getxattr errno %d\n", sb->s_id,
>sb->s_type->name, -rc);
> goto out;
> @@ -743,7 +743,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
> goto out;
> }
> rc = -EINVAL;
> -   printk(KERN_WARNING "SELinux: Unable to set superblock 
> options "
> +   pr_warn("SELinux: Unable to set superblock options "
> "before the security server is initialized\n");
> goto out;
> }
> @@ -785,7 +785,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
>  mount_options[i], ,
>  GFP_KERNEL);
> if (rc) {
> -   printk(KERN_WARNING "SELinux: 
> security_context_str_to_sid"
> +   pr_warn("SELinux: security_context_str_to_sid"
>"(%s) failed for (dev %s, type %s) errno=%d\n",
>mount_options[i], sb->s_id, name, rc);
> goto out;
> @@ -861,8 +861,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
>  */
> rc = security_fs_use(_state, sb);
> if (rc) {
> -   printk(KERN_WARNING
> -   "%s: security_fs_use(%s) returned %d\n",
> +   pr_warn("%s: security_fs_use(%s) returned %d\n",
> __func__, sb->s_type->name, rc);
> goto out;
> }
> @@ -948,7 +947,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
> if (sbsec->behavior != SECURITY_FS_USE_XATTR &&
> sbsec->behavior != SECURITY_FS_USE_NATIVE) {
> rc = -EINVAL;
> -   printk(KERN_WARNING "SELinux: defcontext option is "
> +   pr_warn("SELinux: defcontext option is "
>"invalid for this filesystem type\n");
> goto out;
> }
> @@ -970,7 +969,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
> return rc;
>  out_double_mount:
> rc = -EINVAL;
> -   printk(KERN_WARNING "SELinux: mount invalid.  Same superblock, 
> different "
> +   pr_warn("SELinux: mount invalid.  Same superblock, different "
>"security settings for (dev %s, type %s)\n", sb->s_id, name);
> goto out;
>  }
> @@ -999,7 +998,7 @@ static int selinux_cmp_sb_context(const struct 
> super_block *oldsb,
> }
> return 0;
>  mismatch:
> -   printk(KERN_WARNING "SELinux: mount invalid.  Same superblock, "
> +   pr_warn("SELinux: mount invalid.  Same superblock, "
> "different security settings for (dev %s, "
> "type %s)\n", newsb->s_id, newsb->s_type->name);
> return -EBUSY;
> @@ -1107,7 +1106,7 @@ static int selinux_parse_opts_str(char 

[PATCH 04/13] selinux: Cleanup printk logging in hooks

2018-06-12 Thread Peter Enderborg
Replace printk with pr_* to avoid checkpatch warnings.

Signed-off-by: Peter Enderborg 
---
 security/selinux/hooks.c | 68 +++-
 1 file changed, 33 insertions(+), 35 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 4cafe6a19167..3ab9687ac4c8 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -531,7 +531,7 @@ static int sb_finish_set_opts(struct super_block *sb)
   the first boot of the SELinux kernel before we have
   assigned xattr values to the filesystem. */
if (!(root_inode->i_opflags & IOP_XATTR)) {
-   printk(KERN_WARNING "SELinux: (dev %s, type %s) has no "
+   pr_warn("SELinux: (dev %s, type %s) has no "
   "xattr support\n", sb->s_id, sb->s_type->name);
rc = -EOPNOTSUPP;
goto out;
@@ -540,11 +540,11 @@ static int sb_finish_set_opts(struct super_block *sb)
rc = __vfs_getxattr(root, root_inode, XATTR_NAME_SELINUX, NULL, 
0);
if (rc < 0 && rc != -ENODATA) {
if (rc == -EOPNOTSUPP)
-   printk(KERN_WARNING "SELinux: (dev %s, type "
+   pr_warn("SELinux: (dev %s, type "
   "%s) has no security xattr handler\n",
   sb->s_id, sb->s_type->name);
else
-   printk(KERN_WARNING "SELinux: (dev %s, type "
+   pr_warn("SELinux: (dev %s, type "
   "%s) getxattr errno %d\n", sb->s_id,
   sb->s_type->name, -rc);
goto out;
@@ -743,7 +743,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
goto out;
}
rc = -EINVAL;
-   printk(KERN_WARNING "SELinux: Unable to set superblock options "
+   pr_warn("SELinux: Unable to set superblock options "
"before the security server is initialized\n");
goto out;
}
@@ -785,7 +785,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 mount_options[i], ,
 GFP_KERNEL);
if (rc) {
-   printk(KERN_WARNING "SELinux: 
security_context_str_to_sid"
+   pr_warn("SELinux: security_context_str_to_sid"
   "(%s) failed for (dev %s, type %s) errno=%d\n",
   mount_options[i], sb->s_id, name, rc);
goto out;
@@ -861,8 +861,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 */
rc = security_fs_use(_state, sb);
if (rc) {
-   printk(KERN_WARNING
-   "%s: security_fs_use(%s) returned %d\n",
+   pr_warn("%s: security_fs_use(%s) returned %d\n",
__func__, sb->s_type->name, rc);
goto out;
}
@@ -948,7 +947,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
if (sbsec->behavior != SECURITY_FS_USE_XATTR &&
sbsec->behavior != SECURITY_FS_USE_NATIVE) {
rc = -EINVAL;
-   printk(KERN_WARNING "SELinux: defcontext option is "
+   pr_warn("SELinux: defcontext option is "
   "invalid for this filesystem type\n");
goto out;
}
@@ -970,7 +969,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
return rc;
 out_double_mount:
rc = -EINVAL;
-   printk(KERN_WARNING "SELinux: mount invalid.  Same superblock, 
different "
+   pr_warn("SELinux: mount invalid.  Same superblock, different "
   "security settings for (dev %s, type %s)\n", sb->s_id, name);
goto out;
 }
@@ -999,7 +998,7 @@ static int selinux_cmp_sb_context(const struct super_block 
*oldsb,
}
return 0;
 mismatch:
-   printk(KERN_WARNING "SELinux: mount invalid.  Same superblock, "
+   pr_warn("SELinux: mount invalid.  Same superblock, "
"different security settings for (dev %s, "
"type %s)\n", newsb->s_id, newsb->s_type->name);
return -EBUSY;
@@ -1107,7 +1106,7 @@ static int selinux_parse_opts_str(char *options,
case Opt_context:
if (context || defcontext) {
rc = -EINVAL;
-   printk(KERN_WARNING SEL_MOUNT_FAIL_MSG);
+