]> git.baikalelectronics.ru Git - kernel.git/commit
apparmor: fix aa_label_asxprint return check
authorTom Rix <trix@redhat.com>
Sun, 13 Feb 2022 21:32:28 +0000 (13:32 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:20 +0000 (11:18 +0200)
commitf1921e6cd5bd132f886c4dcf659102968fdefe3c
tree2a183f0b74c2c387214869ca004d18343f08a2ea
parent96b1f1a6d821820d5c80a97ab7fa79f3d6475a02
apparmor: fix aa_label_asxprint return check

commit 7a8940084ce10e2d7016e57c2f1a49cbd18004b8 upstream.

Clang static analysis reports this issue
label.c:1802:3: warning: 2nd function call argument
  is an uninitialized value
  pr_info("%s", str);
  ^~~~~~~~~~~~~~~~~~

str is set from a successful call to aa_label_asxprint(&str, ...)
On failure a negative value is returned, not a -1.  So change
the check.

Fixes: 070afe2d9ac6 ("apparmor: add the base fns() for domain labels")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/apparmor/label.c