Skip to content

Commit a676362

Browse files
Dan CarpenterPeter Zijlstra
authored andcommitted
perf/core: Fix reversed NULL check in perf_event_groups_less()
This NULL check is reversed so it leads to a Smatch warning and presumably a NULL dereference. kernel/events/core.c:1598 perf_event_groups_less() error: we previously assumed 'right->cgrp->css.cgroup' could be null (see line 1590) Fixes: 95ed6c7 ("perf/cgroup: Order events in RB tree by cgroup id") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/20200312105637.GA8960@mwanda
1 parent 90c91df commit a676362

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ perf_event_groups_less(struct perf_event *left, struct perf_event *right)
15861586
*/
15871587
return true;
15881588
}
1589-
if (!right->cgrp || right->cgrp->css.cgroup) {
1589+
if (!right->cgrp || !right->cgrp->css.cgroup) {
15901590
/*
15911591
* Right has no cgroup but left does, no cgroups come
15921592
* first.

0 commit comments

Comments
 (0)