linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] security/apparmor/label.c: Clean code by removing redundant instructions
@ 2020-03-03 18:30 mateusznosek0
  2020-03-03 18:40 ` John Johansen
  0 siblings, 1 reply; 2+ messages in thread
From: mateusznosek0 @ 2020-03-03 18:30 UTC (permalink / raw)
  To: linux-kernel, linux-security-module
  Cc: Mateusz Nosek, serge, jmorris, john.johansen

From: Mateusz Nosek <mateusznosek0@gmail.com>

Previously 'label->proxy->label' value checking
and conditional reassigning were done twice in the same function.
The second one is redundant and can be removed.

Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
---
 security/apparmor/label.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index ba3987242282..676eebcbfd68 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -311,8 +311,6 @@ int aa_vec_unique(struct aa_profile **vec, int n, int flags)
 
 static void label_destroy(struct aa_label *label)
 {
-	struct aa_label *tmp;
-
 	AA_BUG(!label);
 
 	if (!label_isprofile(label)) {
@@ -333,10 +331,6 @@ static void label_destroy(struct aa_label *label)
 
 	aa_free_secid(label->secid);
 
-	tmp = rcu_dereference_protected(label->proxy->label, true);
-	if (tmp == label)
-		rcu_assign_pointer(label->proxy->label, NULL);
-
 	aa_put_proxy(label->proxy);
 	label->proxy = (struct aa_proxy *) PROXY_POISON + 1;
 }
-- 
2.17.1


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

* Re: [PATCH] security/apparmor/label.c: Clean code by removing redundant instructions
  2020-03-03 18:30 [PATCH] security/apparmor/label.c: Clean code by removing redundant instructions mateusznosek0
@ 2020-03-03 18:40 ` John Johansen
  0 siblings, 0 replies; 2+ messages in thread
From: John Johansen @ 2020-03-03 18:40 UTC (permalink / raw)
  To: mateusznosek0, linux-kernel, linux-security-module; +Cc: serge, jmorris

On 3/3/20 10:30 AM, mateusznosek0@gmail.com wrote:
> From: Mateusz Nosek <mateusznosek0@gmail.com>
> 
> Previously 'label->proxy->label' value checking
> and conditional reassigning were done twice in the same function.
> The second one is redundant and can be removed.
> 
> Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
Acked-by: John Johansen <john.johansen@canonical.com>

I will pull this into apparmor-next


> ---
>  security/apparmor/label.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/security/apparmor/label.c b/security/apparmor/label.c
> index ba3987242282..676eebcbfd68 100644
> --- a/security/apparmor/label.c
> +++ b/security/apparmor/label.c
> @@ -311,8 +311,6 @@ int aa_vec_unique(struct aa_profile **vec, int n, int flags)
>  
>  static void label_destroy(struct aa_label *label)
>  {
> -	struct aa_label *tmp;
> -
>  	AA_BUG(!label);
>  
>  	if (!label_isprofile(label)) {
> @@ -333,10 +331,6 @@ static void label_destroy(struct aa_label *label)
>  
>  	aa_free_secid(label->secid);
>  
> -	tmp = rcu_dereference_protected(label->proxy->label, true);
> -	if (tmp == label)
> -		rcu_assign_pointer(label->proxy->label, NULL);
> -
>  	aa_put_proxy(label->proxy);
>  	label->proxy = (struct aa_proxy *) PROXY_POISON + 1;
>  }
> 


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

end of thread, other threads:[~2020-03-03 18:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 18:30 [PATCH] security/apparmor/label.c: Clean code by removing redundant instructions mateusznosek0
2020-03-03 18:40 ` John Johansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).