summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2025-09-22 14:15:50 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-02 13:42:54 +0200
commit53888cd32a3f6d73480096494f7b0c4675a8e080 (patch)
tree2f6acab74bbd740cffdc7038f5c8f0ae1f97d287 /arch
parent09e3bda3a7ba2204361cd08ad02ccd5fd8c77641 (diff)
downloadlinux-53888cd32a3f6d73480096494f7b0c4675a8e080.tar.gz
linux-53888cd32a3f6d73480096494f7b0c4675a8e080.tar.bz2
linux-53888cd32a3f6d73480096494f7b0c4675a8e080.zip
s390/cpum_cf: Fix uninitialized warning after backport of ce971233242b
Upstream commit ce971233242b ("s390/cpum_cf: Deny all sampling events by counter PMU"), backported to 6.6 as commit d660c8d8142e ("s390/cpum_cf: Deny all sampling events by counter PMU"), implicitly depends on the unconditional initialization of err to -ENOENT added by upstream commit aa1ac98268cd ("s390/cpumf: Fix double free on error in cpumf_pmu_event_init()"). The latter change is missing from 6.6, resulting in an instance of -Wuninitialized, which is fairly obvious from looking at the actual diff. arch/s390/kernel/perf_cpum_cf.c:858:10: warning: variable 'err' is uninitialized when used here [-Wuninitialized] 858 | return err; | ^~~ Commit aa1ac98268cd ("s390/cpumf: Fix double free on error in cpumf_pmu_event_init()") depends on commit c70ca298036c ("perf/core: Simplify the perf_event_alloc() error path"), which is a part of a much larger series unsuitable for stable. Extract the unconditional initialization of err to -ENOENT from commit aa1ac98268cd ("s390/cpumf: Fix double free on error in cpumf_pmu_event_init()") and apply it to 6.6 as a standalone change to resolve the warning. Fixes: d660c8d8142e ("s390/cpum_cf: Deny all sampling events by counter PMU") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 771e1cb17540..e590b4c09625 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -852,7 +852,7 @@ static int cpumf_pmu_event_type(struct perf_event *event)
static int cpumf_pmu_event_init(struct perf_event *event)
{
unsigned int type = event->attr.type;
- int err;
+ int err = -ENOENT;
if (is_sampling_event(event)) /* No sampling support */
return err;
@@ -861,8 +861,6 @@ static int cpumf_pmu_event_init(struct perf_event *event)
else if (event->pmu->type == type)
/* Registered as unknown PMU */
err = __hw_perf_event_init(event, cpumf_pmu_event_type(event));
- else
- return -ENOENT;
if (unlikely(err) && event->destroy)
event->destroy(event);