From: JP Kobryn Date: Mon, 21 Apr 2025 16:51:17 +0000 (-0700) Subject: cgroup: fix pointer check in css_rstat_init() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7efbc8f2f9b3eed3ffc6560abf8305859f2153d3;p=users%2Fdwmw2%2Flinux.git cgroup: fix pointer check in css_rstat_init() 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 Signed-off-by: Tejun Heo --- diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 4a8834a70ca66..4d5fd8d12bdd1 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -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; }