All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Johansen <john.johansen@canonical.com>
To: Colin King <colin.king@canonical.com>,
	James Morris <jmorris@namei.org>,
	"Serge E . Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] apparmor: remove redundant pointer 'info'
Date: Fri, 20 Jul 2018 03:31:57 -0700	[thread overview]
Message-ID: <5702474d-5215-cdea-8d77-24f45fef92cc@canonical.com> (raw)
In-Reply-To: <20180714161905.5403-1-colin.king@canonical.com>

On 07/14/2018 09:19 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Pointer 'info' is being assigned but is never used hence it is
> redundant and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'info' set but not used [-Wunused-but-set-variable]
> 
NAK,

real problem wrong fix, instead of deleting the additional context info
we need to be auditing it

diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
index 098d546d8253..08c88de0ffda 100644
--- a/security/apparmor/domain.c
+++ b/security/apparmor/domain.c
@@ -1036,7 +1036,7 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
 audit:
 	aa_audit_file(profile, &nullperms, OP_CHANGE_HAT, AA_MAY_CHANGEHAT,
 		      name, hat ? hat->base.hname : NULL,
-		      hat ? &hat->label : NULL, GLOBAL_ROOT_UID, NULL,
+		      hat ? &hat->label : NULL, GLOBAL_ROOT_UID, info,
 		      error);
 	if (!hat || (error && error != -ENOENT))
 		return ERR_PTR(error);

I pushed this fix into apparmor-next



> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  security/apparmor/domain.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
> index 098d546d8253..410d9ce09861 100644
> --- a/security/apparmor/domain.c
> +++ b/security/apparmor/domain.c
> @@ -1006,7 +1006,6 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  					 const char *name, bool sibling)
>  {
>  	struct aa_profile *root, *hat = NULL;
> -	const char *info = NULL;
>  	int error = 0;
>  
>  	if (sibling && PROFILE_IS_HAT(profile)) {
> @@ -1014,7 +1013,6 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  	} else if (!sibling && !PROFILE_IS_HAT(profile)) {
>  		root = aa_get_profile(profile);
>  	} else {
> -		info = "conflicting target types";
>  		error = -EPERM;
>  		goto audit;
>  	}
> @@ -1025,10 +1023,8 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  		if (COMPLAIN_MODE(profile)) {
>  			hat = aa_new_null_profile(profile, true, name,
>  						  GFP_KERNEL);
> -			if (!hat) {
> -				info = "failed null profile create";
> +			if (!hat)
>  				error = -ENOMEM;
> -			}
>  		}
>  	}
>  	aa_put_profile(root);
> 


WARNING: multiple messages have this Message-ID (diff)
From: John Johansen <john.johansen@canonical.com>
To: linux-security-module@vger.kernel.org
Subject: Re: [PATCH] apparmor: remove redundant pointer 'info'
Date: Fri, 20 Jul 2018 10:31:57 +0000	[thread overview]
Message-ID: <5702474d-5215-cdea-8d77-24f45fef92cc@canonical.com> (raw)
In-Reply-To: <20180714161905.5403-1-colin.king@canonical.com>

On 07/14/2018 09:19 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Pointer 'info' is being assigned but is never used hence it is
> redundant and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'info' set but not used [-Wunused-but-set-variable]
> 
NAK,

real problem wrong fix, instead of deleting the additional context info
we need to be auditing it

diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
index 098d546d8253..08c88de0ffda 100644
--- a/security/apparmor/domain.c
+++ b/security/apparmor/domain.c
@@ -1036,7 +1036,7 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
 audit:
 	aa_audit_file(profile, &nullperms, OP_CHANGE_HAT, AA_MAY_CHANGEHAT,
 		      name, hat ? hat->base.hname : NULL,
-		      hat ? &hat->label : NULL, GLOBAL_ROOT_UID, NULL,
+		      hat ? &hat->label : NULL, GLOBAL_ROOT_UID, info,
 		      error);
 	if (!hat || (error && error != -ENOENT))
 		return ERR_PTR(error);

I pushed this fix into apparmor-next



> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  security/apparmor/domain.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
> index 098d546d8253..410d9ce09861 100644
> --- a/security/apparmor/domain.c
> +++ b/security/apparmor/domain.c
> @@ -1006,7 +1006,6 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  					 const char *name, bool sibling)
>  {
>  	struct aa_profile *root, *hat = NULL;
> -	const char *info = NULL;
>  	int error = 0;
>  
>  	if (sibling && PROFILE_IS_HAT(profile)) {
> @@ -1014,7 +1013,6 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  	} else if (!sibling && !PROFILE_IS_HAT(profile)) {
>  		root = aa_get_profile(profile);
>  	} else {
> -		info = "conflicting target types";
>  		error = -EPERM;
>  		goto audit;
>  	}
> @@ -1025,10 +1023,8 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  		if (COMPLAIN_MODE(profile)) {
>  			hat = aa_new_null_profile(profile, true, name,
>  						  GFP_KERNEL);
> -			if (!hat) {
> -				info = "failed null profile create";
> +			if (!hat)
>  				error = -ENOMEM;
> -			}
>  		}
>  	}
>  	aa_put_profile(root);
> 


WARNING: multiple messages have this Message-ID (diff)
From: john.johansen@canonical.com (John Johansen)
To: linux-security-module@vger.kernel.org
Subject: [PATCH] apparmor: remove redundant pointer 'info'
Date: Fri, 20 Jul 2018 03:31:57 -0700	[thread overview]
Message-ID: <5702474d-5215-cdea-8d77-24f45fef92cc@canonical.com> (raw)
In-Reply-To: <20180714161905.5403-1-colin.king@canonical.com>

On 07/14/2018 09:19 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Pointer 'info' is being assigned but is never used hence it is
> redundant and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'info' set but not used [-Wunused-but-set-variable]
> 
NAK,

real problem wrong fix, instead of deleting the additional context info
we need to be auditing it

diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
index 098d546d8253..08c88de0ffda 100644
--- a/security/apparmor/domain.c
+++ b/security/apparmor/domain.c
@@ -1036,7 +1036,7 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
 audit:
 	aa_audit_file(profile, &nullperms, OP_CHANGE_HAT, AA_MAY_CHANGEHAT,
 		      name, hat ? hat->base.hname : NULL,
-		      hat ? &hat->label : NULL, GLOBAL_ROOT_UID, NULL,
+		      hat ? &hat->label : NULL, GLOBAL_ROOT_UID, info,
 		      error);
 	if (!hat || (error && error != -ENOENT))
 		return ERR_PTR(error);

I pushed this fix into apparmor-next



> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  security/apparmor/domain.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
> index 098d546d8253..410d9ce09861 100644
> --- a/security/apparmor/domain.c
> +++ b/security/apparmor/domain.c
> @@ -1006,7 +1006,6 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  					 const char *name, bool sibling)
>  {
>  	struct aa_profile *root, *hat = NULL;
> -	const char *info = NULL;
>  	int error = 0;
>  
>  	if (sibling && PROFILE_IS_HAT(profile)) {
> @@ -1014,7 +1013,6 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  	} else if (!sibling && !PROFILE_IS_HAT(profile)) {
>  		root = aa_get_profile(profile);
>  	} else {
> -		info = "conflicting target types";
>  		error = -EPERM;
>  		goto audit;
>  	}
> @@ -1025,10 +1023,8 @@ static struct aa_label *build_change_hat(struct aa_profile *profile,
>  		if (COMPLAIN_MODE(profile)) {
>  			hat = aa_new_null_profile(profile, true, name,
>  						  GFP_KERNEL);
> -			if (!hat) {
> -				info = "failed null profile create";
> +			if (!hat)
>  				error = -ENOMEM;
> -			}
>  		}
>  	}
>  	aa_put_profile(root);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-07-20 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-14 16:19 [PATCH] apparmor: remove redundant pointer 'info' Colin King
2018-07-14 16:19 ` Colin King
2018-07-14 16:19 ` Colin King
2018-07-20 10:31 ` John Johansen [this message]
2018-07-20 10:31   ` John Johansen
2018-07-20 10:31   ` John Johansen
2018-07-20 10:57   ` Colin Ian King
2018-07-20 10:57     ` Colin Ian King
2018-07-20 10:57     ` Colin Ian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5702474d-5215-cdea-8d77-24f45fef92cc@canonical.com \
    --to=john.johansen@canonical.com \
    --cc=colin.king@canonical.com \
    --cc=jmorris@namei.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.