Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1682209 > unrolled thread

[PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()

Started byGeert Uytterhoeven <geert@linux-m68k.org>
First post2017-07-06 11:00 +0200
Last post2017-07-06 18:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table() Geert Uytterhoeven <geert@linux-m68k.org> - 2017-07-06 11:00 +0200
    Re: [PATCH] apparmor: Fix shadowed local variable in  unpack_trans_table() "Serge E. Hallyn" <serge@hallyn.com> - 2017-07-06 15:50 +0200
      Re: [PATCH] apparmor: Fix shadowed local variable in  unpack_trans_table() John Johansen <john.johansen@canonical.com> - 2017-07-06 18:00 +0200

#1682209 — [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2017-07-06 11:00 +0200
Subject[PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()
Message-ID<u0aNI-1Z7-25@gated-at.bofh.it>
with W=2:

    security/apparmor/policy_unpack.c: In function ‘unpack_trans_table’:
    security/apparmor/policy_unpack.c:469: warning: declaration of ‘pos’ shadows a previous local
    security/apparmor/policy_unpack.c:451: warning: shadowed declaration is here

Rename the old "pos" to "saved_pos" to fix this.

Fixes: 5379a3312024a8be ("apparmor: support v7 transition format compatible with label_parse")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 security/apparmor/policy_unpack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index c600f4dd1783252a..2d5a1a007b062a73 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -448,7 +448,7 @@ static struct aa_dfa *unpack_dfa(struct aa_ext *e)
  */
 static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
 {
-	void *pos = e->pos;
+	void *saved_pos = e->pos;
 
 	/* exec table is optional */
 	if (unpack_nameX(e, AA_STRUCT, "xtable")) {
@@ -511,7 +511,7 @@ static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
 
 fail:
 	aa_free_domain_entries(&profile->file.trans);
-	e->pos = pos;
+	e->pos = saved_pos;
 	return 0;
 }
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1682447 — Re: [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()

From"Serge E. Hallyn" <serge@hallyn.com>
Date2017-07-06 15:50 +0200
SubjectRe: [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()
Message-ID<u0fkn-4Ys-45@gated-at.bofh.it>
In reply to#1682209
Quoting Geert Uytterhoeven (geert@linux-m68k.org):
> with W=2:
> 
>     security/apparmor/policy_unpack.c: In function ‘unpack_trans_table’:
>     security/apparmor/policy_unpack.c:469: warning: declaration of ‘pos’ shadows a previous local
>     security/apparmor/policy_unpack.c:451: warning: shadowed declaration is here
> 
> Rename the old "pos" to "saved_pos" to fix this.
> 
> Fixes: 5379a3312024a8be ("apparmor: support v7 transition format compatible with label_parse")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Reviewed-by: Serge Hallyn <serge@hallyn.com>

> ---
>  security/apparmor/policy_unpack.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
> index c600f4dd1783252a..2d5a1a007b062a73 100644
> --- a/security/apparmor/policy_unpack.c
> +++ b/security/apparmor/policy_unpack.c
> @@ -448,7 +448,7 @@ static struct aa_dfa *unpack_dfa(struct aa_ext *e)
>   */
>  static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
>  {
> -	void *pos = e->pos;
> +	void *saved_pos = e->pos;
>  
>  	/* exec table is optional */
>  	if (unpack_nameX(e, AA_STRUCT, "xtable")) {
> @@ -511,7 +511,7 @@ static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
>  
>  fail:
>  	aa_free_domain_entries(&profile->file.trans);
> -	e->pos = pos;
> +	e->pos = saved_pos;
>  	return 0;
>  }
>  
> -- 
> 2.7.4

[toc] | [prev] | [next] | [standalone]


#1682530 — Re: [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()

FromJohn Johansen <john.johansen@canonical.com>
Date2017-07-06 18:00 +0200
SubjectRe: [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()
Message-ID<u0hm9-7mU-7@gated-at.bofh.it>
In reply to#1682447
On 07/06/2017 06:44 AM, Serge E. Hallyn wrote:
> Quoting Geert Uytterhoeven (geert@linux-m68k.org):
>> with W=2:
>>
>>     security/apparmor/policy_unpack.c: In function ‘unpack_trans_table’:
>>     security/apparmor/policy_unpack.c:469: warning: declaration of ‘pos’ shadows a previous local
>>     security/apparmor/policy_unpack.c:451: warning: shadowed declaration is here
>>
>> Rename the old "pos" to "saved_pos" to fix this.
>>
>> Fixes: 5379a3312024a8be ("apparmor: support v7 transition format compatible with label_parse")
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Reviewed-by: Serge Hallyn <serge@hallyn.com>
Acked-by: John Johansen <john.johansen@canonical.com>

I will pull this into my tree for my next pull request

> 
>> ---
>>  security/apparmor/policy_unpack.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
>> index c600f4dd1783252a..2d5a1a007b062a73 100644
>> --- a/security/apparmor/policy_unpack.c
>> +++ b/security/apparmor/policy_unpack.c
>> @@ -448,7 +448,7 @@ static struct aa_dfa *unpack_dfa(struct aa_ext *e)
>>   */
>>  static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
>>  {
>> -	void *pos = e->pos;
>> +	void *saved_pos = e->pos;
>>  
>>  	/* exec table is optional */
>>  	if (unpack_nameX(e, AA_STRUCT, "xtable")) {
>> @@ -511,7 +511,7 @@ static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
>>  
>>  fail:
>>  	aa_free_domain_entries(&profile->file.trans);
>> -	e->pos = pos;
>> +	e->pos = saved_pos;
>>  	return 0;
>>  }
>>  
>> -- 
>> 2.7.4

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web