]> git.baikalelectronics.ru Git - kernel.git/commit
RISC-V: Fix /proc/cpuinfo cpumask warning
authorAndrew Jones <ajones@ventanamicro.com>
Fri, 14 Oct 2022 15:58:44 +0000 (17:58 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 27 Oct 2022 22:23:19 +0000 (15:23 -0700)
commit514ae15239a3bb44c01a6e924e41ceb0da7de103
tree5d96fff7ad69836db03f8cce8fcd09bc6e41250e
parentcb201b760b9161488e78dd267db2d09e2612be94
RISC-V: Fix /proc/cpuinfo cpumask warning

Commit b55d5df4cb41 ("cpumask: fix checking valid cpu range") has
started issuing warnings[*] when cpu indices equal to nr_cpu_ids - 1
are passed to cpumask_next* functions. seq_read_iter() and cpuinfo's
start and next seq operations implement a pattern like

  n = cpumask_next(n - 1, mask);
  show(n);
  while (1) {
      ++n;
      n = cpumask_next(n - 1, mask);
      if (n >= nr_cpu_ids)
          break;
      show(n);
  }

which will issue the warning when reading /proc/cpuinfo. Ensure no
warning is generated by validating the cpu index before calling
cpumask_next().

[*] Warnings will only appear with DEBUG_PER_CPU_MAPS enabled.

Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Yury Norov <yury.norov@gmail.com>
Link: https://lore.kernel.org/r/20221014155845.1986223-2-ajones@ventanamicro.com/
Fixes: b55d5df4cb41 ("cpumask: fix checking valid cpu range")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/cpu.c