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:40:00 +0000 (11:40 +0200)
commit3104c8a0dc5fd0779a6bc35e09dfdbe17e845dc7
treeaff56fedc4bfd9e462e1024c5da183a92a307713
parenta683a0d87a22a924e3040de506f42d8d4842937f
apparmor: fix aa_label_asxprint return check

commit 3e2a3a0830a2090e766d0d887d52c67de2a6f323 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: f1bd904175e8 ("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