]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: fix error check
authorTom Rix <trix@redhat.com>
Sun, 4 Oct 2020 14:24:22 +0000 (07:24 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Sun, 7 Feb 2021 12:15:46 +0000 (04:15 -0800)
commit033d08a506906a6cf0d3c153052036b55d8de97c
treee1d2e3902e8854a3d75833144733f3d5f3582f95
parent3882041df3faddc33f08ce424bf0b1554303201e
apparmor: fix error check

clang static analysis reports this representative problem:

label.c:1463:16: warning: Assigned value is garbage or undefined
        label->hname = name;
                     ^ ~~~~

In aa_update_label_name(), this the problem block of code

if (aa_label_acntsxprint(&name, ...) == -1)
return res;

On failure, aa_label_acntsxprint() has a more complicated return
that just -1.  So check for a negative return.

It was also noted that the aa_label_acntsxprint() main comment refers
to a nonexistent parameter, so clean up the comment.

Fixes: 070afe2d9ac6 ("apparmor: add the base fns() for domain labels")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/label.c