提交 67dc6616 编写于 作者: T Tom Rix 提交者: Zheng Zengkai

apparmor: fix aa_label_asxprint return check

stable inclusion
from stable-v5.10.138
commit 4188f91c82e3720afd6c65f698ce88c867e02588
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60QFD

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4188f91c82e3720afd6c65f698ce88c867e02588

--------------------------------

commit 3e2a3a08 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: f1bd9041 ("apparmor: add the base fns() for domain labels")
Signed-off-by: NTom Rix <trix@redhat.com>
Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 8bc7670e
......@@ -1745,7 +1745,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;
}
......@@ -1773,7 +1773,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;
}
......@@ -1796,7 +1796,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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册