]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
cgroup: fix pointer check in css_rstat_init()
authorJP Kobryn <inwardvessel@gmail.com>
Mon, 21 Apr 2025 16:51:17 +0000 (09:51 -0700)
committerTejun Heo <tj@kernel.org>
Mon, 21 Apr 2025 18:27:33 +0000 (08:27 -1000)
In css_rstat_init() allocations are done for the cgroup's pointers
rstat_cpu and rstat_base_cpu. Make sure the allocation checks are
consistent with what they are allocating.

Signed-off-by: JP Kobryn <inwardvessel@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/rstat.c

index 4a8834a70ca66933f6a00cb5a664e5cd4877b6a9..4d5fd8d12bdd1c249b7cc8a89e18419da4e1e6a7 100644 (file)
@@ -371,7 +371,7 @@ int css_rstat_init(struct cgroup_subsys_state *css)
 
        if (!cgrp->rstat_base_cpu) {
                cgrp->rstat_base_cpu = alloc_percpu(struct cgroup_rstat_base_cpu);
-               if (!cgrp->rstat_cpu) {
+               if (!cgrp->rstat_base_cpu) {
                        free_percpu(cgrp->rstat_cpu);
                        return -ENOMEM;
                }