linux-stable/arch/mips
Huacai Chen e41db8a9ce MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
commit e1a534f5d0 upstream.

When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected,
cpu_max_bits_warn() generates a runtime warning similar as below while
we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit)
instead of NR_CPUS to iterate CPUs.

[    3.052463] ------------[ cut here ]------------
[    3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0
[    3.070072] Modules linked in: efivarfs autofs4
[    3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052
[    3.084034] Hardware name: Loongson Loongson-3A4000-7A1000-1w-V0.1-CRB/Loongson-LS3A4000-7A1000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V2.0.04082-beta7 04/27
[    3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000
[    3.109127]         9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430
[    3.118774]         90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff
[    3.128412]         0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890
[    3.138056]         0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa
[    3.147711]         ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000
[    3.157364]         900000000101c998 0000000000000004 9000000000ef7430 0000000000000000
[    3.167012]         0000000000000009 000000000000006c 0000000000000000 0000000000000000
[    3.176641]         9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286
[    3.186260]         00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c
[    3.195868]         ...
[    3.199917] Call Trace:
[    3.203941] [<98000000002086d8>] show_stack+0x38/0x14c
[    3.210666] [<9800000000cf846c>] dump_stack_lvl+0x60/0x88
[    3.217625] [<980000000023d268>] __warn+0xd0/0x100
[    3.223958] [<9800000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc
[    3.231150] [<9800000000210220>] show_cpuinfo+0x5e8/0x5f0
[    3.238080] [<98000000004f578c>] seq_read_iter+0x354/0x4b4
[    3.245098] [<98000000004c2e90>] new_sync_read+0x17c/0x1c4
[    3.252114] [<98000000004c5174>] vfs_read+0x138/0x1d0
[    3.258694] [<98000000004c55f8>] ksys_read+0x70/0x100
[    3.265265] [<9800000000cfde9c>] do_syscall+0x7c/0x94
[    3.271820] [<9800000000202fe4>] handle_syscall+0xc4/0x160
[    3.281824] ---[ end trace 8b484262b4b8c24c ]---

Cc: stable@vger.kernel.org
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-17 14:22:58 +02:00
..
alchemy MIPS: Alchemy: Fix spelling contraction "cant" -> "can't" 2021-07-29 11:41:05 +02:00
ar7 mips: ar7: convert to CONFIG_COMMON_CLK 2021-06-08 17:00:09 +02:00
ath25 mips: Bulk conversion to generic_handle_domain_irq() 2021-08-12 11:39:40 +01:00
ath79
bcm47xx
bcm63xx mips: bcm63xx: add support for clk_set_parent() 2022-01-27 11:04:18 +01:00
bmips MIPS: bmips: include <linux/dma-direct.h> for phys_to_dma 2021-03-06 08:43:40 +01:00
boot MIPS: ingenic: correct unit node address 2022-04-13 20:59:09 +02:00
cavium-octeon MIPS: octeon: Fix missed PTR->PTR_WD conversion 2022-02-16 12:56:40 +01:00
cobalt
configs Documentation, arch: Remove leftovers from CIFS_WEAK_PW_HASH 2022-01-27 11:05:21 +01:00
crypto asm-generic: unaligned always use struct helpers 2021-05-10 17:50:47 +02:00
dec mips: DEC: honor CONFIG_MIPS_FP_SUPPORT=n 2022-04-08 14:23:38 +02:00
fw
generic MIPS: generic/yamon-dt: fix uninitialized variable error 2021-11-25 09:48:36 +01:00
include MIPS: IP30: Remove incorrect `cpu_has_fpu' override 2022-06-09 10:23:31 +02:00
ingenic MIPS: Kconfig: ingenic: Ensure MACH_INGENIC_GENERIC selects all SoCs 2021-06-01 11:44:47 +02:00
jazz MIPS/jazzdma: return error code from jazz_dma_map_sg() 2021-08-09 17:13:05 +02:00
kernel MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-08-17 14:22:58 +02:00
kvm ARM: 2021-09-07 13:40:51 -07:00
lantiq MIPS: lantiq: check the return value of kzalloc() 2022-05-25 09:57:26 +02:00
lib MIPS: Fix build error due to PTR used in more places 2022-02-16 12:56:16 +01:00
loongson2ef MIPS: loongson2ef: don't build serial.o unconditionally 2021-08-05 10:58:21 +02:00
loongson32
loongson64 PCI/sysfs: Find shadow ROM before static attribute initialization 2022-02-01 17:27:05 +01:00
math-emu
mm MIPS: Sanitise Cavium switch cases in TLB handler synthesizers 2022-04-08 14:23:38 +02:00
mti-malta - converted Pistachio platform to use MIPS generic kernel 2021-09-03 11:11:54 -07:00
n64
net bpf, mips: Validate conditional branch offsets 2021-09-15 21:38:16 +02:00
netlogic mips: netlogic: fix kernel-doc complaints in fmn-config.c 2021-07-22 11:48:06 +02:00
pci mips: Bulk conversion to generic_handle_domain_irq() 2021-08-12 11:39:40 +01:00
pic32 clkdev: remove CONFIG_CLKDEV_LOOKUP 2021-06-08 17:00:09 +02:00
power
ralink mips: ralink: fix a refcount leak in ill_acc_of_setup() 2022-04-13 20:59:07 +02:00
rb532 MIPS: RB532: fix return value of __setup handler 2022-04-08 14:23:39 +02:00
sgi-ip22 bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
sgi-ip27 mips: Bulk conversion to generic_handle_domain_irq() 2021-08-12 11:39:40 +01:00
sgi-ip30 mips: Bulk conversion to generic_handle_domain_irq() 2021-08-12 11:39:40 +01:00
sgi-ip32 kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
sibyte
sni MIPS: sni: Fix the build 2021-11-25 09:48:28 +01:00
tools
txx9
vdso MIPS: Makefile: Replace -pg with CC_FLAGS_FTRACE 2021-04-21 13:44:35 +02:00
vr41xx MIPS: Remove repetitive increase irq_err_count 2022-06-29 09:03:24 +02:00
Kbuild
Kbuild.platforms MIPS: fix duplicated slashes for Platform file path 2021-11-18 19:17:14 +01:00
Kconfig mips: fix Kconfig reference to PHYS_ADDR_T_64BIT 2022-01-27 11:04:13 +01:00
Kconfig.debug tracing: Refactor TRACE_IRQFLAGS_SUPPORT in Kconfig 2021-08-16 11:37:21 -04:00
Makefile MIPS: fix *-pkg builds for loongson2ef platform 2021-11-18 19:17:14 +01:00
Makefile.postlink