mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
apparmor: fix error check
[ Upstream commitd108370c64
] 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>
This commit is contained in:
parent
c639d5aec7
commit
65b9b70561
1 changed files with 2 additions and 2 deletions
|
@ -1431,7 +1431,7 @@ bool aa_update_label_name(struct aa_ns *ns, struct aa_label *label, gfp_t gfp)
|
||||||
if (label->hname || labels_ns(label) != ns)
|
if (label->hname || labels_ns(label) != ns)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) == -1)
|
if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
ls = labels_set(label);
|
ls = labels_set(label);
|
||||||
|
@ -1681,7 +1681,7 @@ int aa_label_asxprint(char **strp, struct aa_ns *ns, struct aa_label *label,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aa_label_acntsxprint - allocate a __counted string buffer and print label
|
* aa_label_acntsxprint - allocate a __counted string buffer and print label
|
||||||
* @strp: buffer to write to. (MAY BE NULL if @size == 0)
|
* @strp: buffer to write to.
|
||||||
* @ns: namespace profile is being viewed from
|
* @ns: namespace profile is being viewed from
|
||||||
* @label: label to view (NOT NULL)
|
* @label: label to view (NOT NULL)
|
||||||
* @flags: flags controlling what label info is printed
|
* @flags: flags controlling what label info is printed
|
||||||
|
|
Loading…
Reference in a new issue