Skip to content

Commit

Permalink
apparmor: Fix shadowed local variable in unpack_trans_table()
Browse files Browse the repository at this point in the history
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: 5379a33 ("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>
Signed-off-by: John Johansen <john.johansen@canonical.com>
  • Loading branch information
Geert Uytterhoeven authored and John Johansen committed Sep 22, 2017
1 parent 520eccd commit 19fe43a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/apparmor/policy_unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 19fe43a

Please sign in to comment.