Skip to content

Commit d108370

Browse files
Tom Rixjrjohansen
authored andcommitted
apparmor: fix error check
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: f1bd904 ("apparmor: add the base fns() for domain labels") Signed-off-by: Tom Rix <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent 4af7c86 commit d108370

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security/apparmor/label.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ bool aa_update_label_name(struct aa_ns *ns, struct aa_label *label, gfp_t gfp)
14531453
if (label->hname || labels_ns(label) != ns)
14541454
return res;
14551455

1456-
if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) == -1)
1456+
if (aa_label_acntsxprint(&name, ns, label, FLAGS_NONE, gfp) < 0)
14571457
return res;
14581458

14591459
ls = labels_set(label);
@@ -1703,7 +1703,7 @@ int aa_label_asxprint(char **strp, struct aa_ns *ns, struct aa_label *label,
17031703

17041704
/**
17051705
* aa_label_acntsxprint - allocate a __counted string buffer and print label
1706-
* @strp: buffer to write to. (MAY BE NULL if @size == 0)
1706+
* @strp: buffer to write to.
17071707
* @ns: namespace profile is being viewed from
17081708
* @label: label to view (NOT NULL)
17091709
* @flags: flags controlling what label info is printed

0 commit comments

Comments
 (0)