summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2022-02-13 13:32:28 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-25 11:15:36 +0200
commit5fc2dbf79d14bc2da5dfc6ac66e5d0ca31057652 (patch)
treec852a233fc7fce81a376e9a3226ddb0067f13afd
parent36f846a8422455a876cdea9e367594eefdb6ebf5 (diff)
downloadlinux-stable-5fc2dbf79d14bc2da5dfc6ac66e5d0ca31057652.tar.gz
linux-stable-5fc2dbf79d14bc2da5dfc6ac66e5d0ca31057652.tar.bz2
linux-stable-5fc2dbf79d14bc2da5dfc6ac66e5d0ca31057652.zip
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>
-rw-r--r--security/apparmor/label.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index dae9152c75f2..fed6bd75fcc1 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -1754,7 +1754,7 @@ void aa_label_xaudit(struct audit_buffer *ab, struct aa_ns *ns,
if (!use_label_hname(ns, label, flags) ||
display_mode(ns, label, flags)) {
len = aa_label_asxprint(&name, ns, label, flags, gfp);
- if (len == -1) {
+ if (len < 0) {
AA_DEBUG("label print error");
return;
}
@@ -1782,7 +1782,7 @@ void aa_label_seq_xprint(struct seq_file *f, struct aa_ns *ns,
int len;
len = aa_label_asxprint(&str, ns, label, flags, gfp);
- if (len == -1) {
+ if (len < 0) {
AA_DEBUG("label print error");
return;
}
@@ -1805,7 +1805,7 @@ void aa_label_xprintk(struct aa_ns *ns, struct aa_label *label, int flags,
int len;
len = aa_label_asxprint(&str, ns, label, flags, gfp);
- if (len == -1) {
+ if (len < 0) {
AA_DEBUG("label print error");
return;
}