Kees Cook
0cb2c00dd1
ARM: vexpress/spc: Avoid negative array index when !SMP
...
[ Upstream commit b3f1dd52c991d79118f35e6d1bf4d7cb09882e38 ]
When building multi_v7_defconfig+CONFIG_SMP=n, -Warray-bounds exposes
a couple negative array index accesses:
arch/arm/mach-vexpress/spc.c: In function 've_spc_clk_init':
arch/arm/mach-vexpress/spc.c:583:21: warning: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Warray-bounds]
583 | if (init_opp_table[cluster])
| ~~~~~~~~~~~~~~^~~~~~~~~
arch/arm/mach-vexpress/spc.c:556:7: note: while referencing 'init_opp_table'
556 | bool init_opp_table[MAX_CLUSTERS] = { false };
| ^~~~~~~~~~~~~~
arch/arm/mach-vexpress/spc.c:592:18: warning: array subscript -1 is below array bounds of 'bool[2]' {aka '_Bool[2]'} [-Warray-bounds]
592 | init_opp_table[cluster] = true;
| ~~~~~~~~~~~~~~^~~~~~~~~
arch/arm/mach-vexpress/spc.c:556:7: note: while referencing 'init_opp_table'
556 | bool init_opp_table[MAX_CLUSTERS] = { false };
| ^~~~~~~~~~~~~~
Skip this logic when built !SMP.
Link: https://lore.kernel.org/r/20220331190443.851661-1-keescook@chromium.org
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-27 13:50:47 +02:00
..
2021-09-30 10:09:26 +02:00
2021-09-22 12:26:45 +02:00
2022-04-27 13:50:47 +02:00
2022-04-20 09:19:37 +02:00
2022-01-20 09:19:18 +01:00
2021-02-17 10:35:18 +01:00
2021-11-26 10:47:21 +01:00
2022-03-08 19:07:48 +01:00
2021-11-17 09:48:46 +01:00
2022-04-15 14:18:08 +02:00
2022-04-15 14:18:34 +02:00
2022-03-28 08:46:48 +02:00
2022-04-15 14:18:08 +02:00
2021-09-22 12:26:24 +02:00
2022-04-15 14:18:36 +02:00
2022-04-20 09:19:37 +02:00
2022-04-15 14:18:31 +02:00
2022-02-01 17:24:33 +01:00
2021-11-26 10:47:17 +01:00
2021-10-09 14:39:49 +02:00
2022-04-15 14:18:31 +02:00
2022-04-15 14:18:39 +02:00
2022-04-15 14:18:34 +02:00
2020-12-30 11:51:47 +01:00