Skip to content

Commit d825c06

Browse files
James Hoganralfbaechle
authored andcommitted
MIPS: smp.c: Fix uninitialised temp_foreign_map
When calculate_cpu_foreign_map() recalculates the cpu_foreign_map cpumask it uses the local variable temp_foreign_map without initialising it to zero. Since the calculation only ever sets bits in this cpumask any existing bits at that memory location will remain set and find their way into cpu_foreign_map too. This could potentially lead to cache operations suboptimally doing smp calls to multiple VPEs in the same core, even though the VPEs share primary caches. Therefore initialise temp_foreign_map using cpumask_clear() before use. Fixes: cccf34e ("MIPS: c-r4k: Fix cache flushing for MT cores") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/12759/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 7a50e46 commit d825c06

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/mips/kernel/smp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ static inline void calculate_cpu_foreign_map(void)
121121
cpumask_t temp_foreign_map;
122122

123123
/* Re-calculate the mask */
124+
cpumask_clear(&temp_foreign_map);
124125
for_each_online_cpu(i) {
125126
core_present = 0;
126127
for_each_cpu(k, &temp_foreign_map)

0 commit comments

Comments
 (0)