linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()
@ 2017-07-06  8:56 Geert Uytterhoeven
  2017-07-06 13:44 ` Serge E. Hallyn
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2017-07-06  8:56 UTC (permalink / raw)
  To: John Johansen, James Morris, Serge E . Hallyn
  Cc: linux-security-module, linux-kernel, Geert Uytterhoeven

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

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

* Re: [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()
  2017-07-06  8:56 [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table() Geert Uytterhoeven
@ 2017-07-06 13:44 ` Serge E. Hallyn
  2017-07-06 15:50   ` John Johansen
  0 siblings, 1 reply; 3+ messages in thread
From: Serge E. Hallyn @ 2017-07-06 13:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: John Johansen, James Morris, Serge E . Hallyn,
	linux-security-module, linux-kernel

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

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

* Re: [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table()
  2017-07-06 13:44 ` Serge E. Hallyn
@ 2017-07-06 15:50   ` John Johansen
  0 siblings, 0 replies; 3+ messages in thread
From: John Johansen @ 2017-07-06 15:50 UTC (permalink / raw)
  To: Serge E. Hallyn, Geert Uytterhoeven
  Cc: James Morris, linux-security-module, linux-kernel

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

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

end of thread, other threads:[~2017-07-06 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-06  8:56 [PATCH] apparmor: Fix shadowed local variable in unpack_trans_table() Geert Uytterhoeven
2017-07-06 13:44 ` Serge E. Hallyn
2017-07-06 15:50   ` 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).