Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/perf: arm_pmu_acpi: Fix incorrect checking of gicc pointer

Fix bogus NULL checks on the return value of acpi_cpu_get_madt_gicc()
by checking for a 0 'gicc->performance_interrupt' value instead.

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
Signed-off-by: Will Deacon <will@kernel.org>

authored by

luanshi and committed by
Will Deacon
3ba52ad5 049d9191

+2 -5
+2 -5
drivers/perf/arm_pmu_acpi.c
··· 24 24 int gsi, trigger; 25 25 26 26 gicc = acpi_cpu_get_madt_gicc(cpu); 27 - if (WARN_ON(!gicc)) 28 - return -EINVAL; 29 27 30 28 gsi = gicc->performance_interrupt; 31 29 ··· 62 64 int gsi; 63 65 64 66 gicc = acpi_cpu_get_madt_gicc(cpu); 65 - if (!gicc) 66 - return; 67 67 68 68 gsi = gicc->performance_interrupt; 69 - acpi_unregister_gsi(gsi); 69 + if (gsi) 70 + acpi_unregister_gsi(gsi); 70 71 } 71 72 72 73 #if IS_ENABLED(CONFIG_ARM_SPE_PMU)