Kees Cook
9995aa5fe0
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:14:10 +02:00
..
2021-10-06 10:23:40 +02:00
2021-11-12 13:18:01 +01:00
2022-04-27 13:14:10 +02:00
2022-04-20 09:06:44 +02:00
2018-05-19 10:27:00 +02:00
2021-02-23 13:59:16 +01:00
2021-11-26 11:48:42 +01:00
2021-12-08 08:45:03 +01:00
2021-11-26 11:48:38 +01:00
2020-02-28 15:42:42 +01:00
2022-04-20 09:06:42 +02:00
2021-11-02 17:39:23 +01:00
2021-09-22 11:43:04 +02:00
2022-03-02 11:32:00 +01:00
2022-04-20 09:06:42 +02:00
2022-02-08 18:15:26 +01:00
2022-01-27 08:47:42 +01:00
2022-01-27 08:47:42 +01:00
2020-01-12 11:24:19 +01:00
2022-01-27 08:47:38 +01:00
2022-04-20 09:06:44 +02:00
2022-04-20 09:06:43 +02:00
2018-08-15 18:14:46 +02:00