WSL2-Linux-Kernel/security/apparmor
Tom Rix 4f3de16a3c apparmor: fix error check
[ Upstream commit d108370c64 ]

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: f1bd904175 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18 19:16:58 +01:00
..
include
.gitignore
Kconfig
Makefile
apparmorfs.c
audit.c
capability.c
crypto.c
domain.c
file.c
ipc.c
label.c
lib.c
lsm.c
match.c
mount.c
net.c
nulldfa.in
path.c
policy.c
policy_ns.c
policy_unpack.c
policy_unpack_test.c
procattr.c
resource.c
secid.c
stacksplitdfa.in
task.c