acrn-kernel/arch/arm/mach-omap2
Gustavo A. R. Silva 7a7f112833 ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
commit 847fb80cc0 upstream.

If function pwrdm_read_prev_pwrst() returns -EINVAL, we will end
up accessing array pwrdm->state_counter through negative index
-22. This is wrong and the compiler is legitimately warning us
about this potential problem.

Fix this by sanity checking the value stored in variable _prev_
before accessing array pwrdm->state_counter.

Address the following -Warray-bounds warning:
arch/arm/mach-omap2/powerdomain.c:178:45: warning: array subscript -22 is below array bounds of 'unsigned int[4]' [-Warray-bounds]

Link: https://github.com/KSPP/linux/issues/307
Fixes: ba20bb1269 ("OMAP: PM counter infrastructure.")
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/20230607050639.LzbPn%25lkp@intel.com/
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Message-ID: <ZIFVGwImU3kpaGeH@work>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-13 09:43:00 +02:00
..
.gitignore
Kconfig ARM: SoC updates for 6.0 2022-08-02 08:02:59 -07:00
Makefile ARM: omap2: remove include/mach/ subdirectory 2022-04-29 09:52:46 +02:00
am33xx-restart.c
am33xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
board-generic.c ARM: omap2: fix missing tick_broadcast() prototype 2023-07-19 16:21:23 +02:00
board-n8x0.c ARM: OMAP2+: Fix build warning when mmc_omap is not built 2021-05-18 09:44:42 +03:00
clkt2xxx_dpll.c
clkt2xxx_dpllcore.c
clkt2xxx_virt_prcm_set.c ARM: OMAP2+: Fix kfree NULL pointer in omap2xxx_clkt_vps_init 2020-11-19 11:44:46 +02:00
clock.c
clock.h
clock2xxx.h
clock3xxx.h
clockdomain.c ARM: OMAP2+: fix spellint typo 2021-01-26 13:43:17 +02:00
clockdomain.h
clockdomains2xxx_3xxx_data.c
clockdomains3xxx_data.c
clockdomains7xx_data.c
clockdomains33xx_data.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clockdomains43xx_data.c
clockdomains44xx_data.c
clockdomains54xx_data.c
clockdomains81xx_data.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clockdomains2420_data.c
clockdomains2430_data.c
cm-regbits-7xx.h ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
cm-regbits-24xx.h
cm-regbits-33xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
cm-regbits-34xx.h
cm-regbits-44xx.h ARM: OMAP2+: Drop unused CM and SCRM defines for omap4 2021-10-06 12:36:22 +03:00
cm-regbits-54xx.h ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
cm.h ARM: OMAP2+: CM: remove omap2_set_globals_cm() 2021-05-21 12:27:59 +03:00
cm1_7xx.h ARM: OMAP2+: Drop unused CM defines for dra7 2021-10-06 12:36:22 +03:00
cm1_44xx.h ARM: OMAP2+: Drop unused CM and SCRM defines for omap4 2021-10-06 12:36:22 +03:00
cm1_54xx.h ARM: OMAP2+: Drop unused CM and SCRM defines for omap5 2021-10-06 12:36:22 +03:00
cm2_7xx.h ARM: OMAP2+: Drop unused CM defines for dra7 2021-10-06 12:36:22 +03:00
cm2_44xx.h ARM: OMAP2+: Drop unused CM and SCRM defines for omap4 2021-10-06 12:36:22 +03:00
cm2_54xx.h ARM: OMAP2+: Drop unused CM and SCRM defines for omap5 2021-10-06 12:36:22 +03:00
cm2xxx.c
cm2xxx.h
cm2xxx_3xxx.h
cm3xxx.c
cm3xxx.h
cm33xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
cm33xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
cm44xx.h
cm81xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
cm_common.c ARM: OMAP2+: add missing of_node_put before break and return 2022-04-21 14:47:15 +03:00
cminst44xx.c
common-board-devices.h
common.c
common.h ARM: omap: fix missing declaration warnings 2022-04-29 09:53:28 +02:00
control.c ARM: OMAP2+: add missing of_node_put before break and return 2022-04-21 14:47:15 +03:00
control.h ARM: OMAP2+: remove omap2_set_globals_control() 2021-05-21 12:28:47 +03:00
cpuidle34xx.c
cpuidle44xx.c ARM: OMAP2+: Fix suspcious RCU usage splats for omap_enter_idle_coupled 2021-01-15 12:48:07 +02:00
ctrl_module_wkup_44xx.h
devices.c
display.c SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
display.h
dma.c ARM: omap: fix missing declaration warnings 2022-04-29 09:53:28 +02:00
fb.c
gpmc.h
hdq1w.c
hdq1w.h
i2c.c
i2c.h
id.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
id.h
io.c ARM: OMAP2+: Stop building legacy code for dra7 and omap4/5 2021-03-12 10:11:24 +02:00
iomap.h
l3_2xxx.h ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
l3_3xxx.h ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
l4_2xxx.h ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
l4_3xxx.h
mcbsp.c
mmc.h arch: arm: mach-omap2: mmc: Move omap_mmc_notify_cover_event() prototype 2020-07-13 12:18:26 +02:00
msdi.c
omap-headsmp.S
omap-hotplug.c
omap-iommu.c ARM: omap: fix missing declaration warnings 2022-04-29 09:53:28 +02:00
omap-mpuss-lowpower.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
omap-secure.c ARM: omap: fix address space warnings from sparse 2022-04-29 09:53:28 +02:00
omap-secure.h ARM: omap: fix address space warnings from sparse 2022-04-29 09:53:28 +02:00
omap-smc.S
omap-smp.c
omap-wakeupgen.c
omap-wakeupgen.h
omap2-restart.c
omap3-restart.c
omap4-common.c ARM: OMAP2+: omap4-common: Fix refcount leak bug 2023-03-10 09:33:45 +01:00
omap4-restart.c
omap4-sar-layout.h
omap24xx.h
omap34xx.h
omap44xx.h
omap54xx.h
omap_device.c ARM: OMAP2+: drop hwmod-clock helper comment 2022-04-21 14:47:15 +03:00
omap_device.h ARM: OMAP2+: drop omap_device_register() helper 2022-04-21 14:47:15 +03:00
omap_hwmod.c ARM: OMAP2+: hwmod: Add of_node_put() before break 2021-12-17 14:08:10 +02:00
omap_hwmod.h ARM: OMAP2+: Stop building legacy code for dra7 and omap4/5 2021-03-12 10:11:24 +02:00
omap_hwmod_2xxx_3xxx_ipblock_data.c
omap_hwmod_2xxx_interconnect_data.c
omap_hwmod_2xxx_ipblock_data.c
omap_hwmod_3xxx_data.c
omap_hwmod_81xx_data.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
omap_hwmod_2420_data.c
omap_hwmod_2430_data.c
omap_hwmod_common_data.c
omap_hwmod_common_data.h
omap_hwmod_common_ipblock_data.c
omap_hwmod_reset.c
omap_opp_data.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
omap_phy_internal.c ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
omap_twl.c ARM: OMAP2+: fix incorrect kernel-doc comment syntax in file 2021-03-31 09:04:22 +03:00
opp2xxx.h
opp3xxx_data.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
opp4xxx_data.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
opp2420_data.c
opp2430_data.c
pdata-quirks.c ARM: OMAP2+: pdata-quirks: Fix refcount leak bug 2022-06-28 07:58:51 +03:00
pm-asm-offsets.c
pm-debug.c ARM: OMAP2+: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE 2021-03-24 13:27:36 +02:00
pm.c ARM: omap3: enable off mode automatically 2020-09-24 14:26:20 +03:00
pm.h ARM: omap3: enable off mode automatically 2020-09-24 14:26:20 +03:00
pm24xx.c
pm33xx-core.c ARM: OMAP2+: Block suspend for am3 and am4 if PM is not configured 2021-06-11 10:43:08 +03:00
pm34xx.c memory: omap-gpmc: Drop custom PM calls with cpu_pm notifier 2021-07-29 09:02:27 +02:00
pm44xx.c
pmic-cpcap.c ARM: OMAP4: Fix PMIC voltage domains for bionic 2021-03-17 15:15:45 +02:00
powerdomain-common.c
powerdomain.c ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch() 2023-09-13 09:43:00 +02:00
powerdomain.h
powerdomains2xxx_3xxx_data.c
powerdomains2xxx_3xxx_data.h
powerdomains2xxx_data.c
powerdomains3xxx_data.c
powerdomains7xx_data.c
powerdomains33xx_data.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
powerdomains43xx_data.c
powerdomains44xx_data.c
powerdomains54xx_data.c
prcm-common.h
prcm43xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 1) 2022-06-10 14:51:35 +02:00
prcm44xx.h
prcm_mpu7xx.h ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
prcm_mpu44xx.c
prcm_mpu44xx.h
prcm_mpu54xx.h ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
prcm_mpu_44xx_54xx.h
prm-regbits-24xx.h
prm-regbits-33xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
prm-regbits-34xx.h
prm-regbits-44xx.h
prm.h
prm2xxx.c
prm2xxx.h
prm2xxx_3xxx.c
prm2xxx_3xxx.h
prm3xxx.c ARM: OMAP2+: Fix refcount leak in omap3xxx_prm_late_init 2022-06-28 08:09:30 +03:00
prm3xxx.h
prm7xx.h ARM: OMAP2+: Drop unused PRM defines for dra7 2021-10-06 12:17:17 +03:00
prm33xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
prm33xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
prm44xx.c
prm44xx.h ARM: OMAP2+: Drop unused PRM defines for omap4 2021-10-06 12:23:28 +03:00
prm44xx_54xx.h
prm54xx.h ARM: OMAP2+: Drop unused PRM defines for omap5 2021-10-06 12:20:34 +03:00
prm_common.c ARM: OMAP2+: add missing of_node_put before break and return 2022-04-21 14:47:15 +03:00
prminst44xx.c
prminst44xx.h
scrm44xx.h ARM: OMAP2+: Drop unused CM and SCRM defines for omap4 2021-10-06 12:36:22 +03:00
sdrc.c
sdrc.h
sdrc2xxx.c
serial.h ARM: omap2: remove include/mach/ subdirectory 2022-04-29 09:52:46 +02:00
sleep24xx.S
sleep33xx.S ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
sleep34xx.S
sleep43xx.S ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
sleep44xx.S
smartreflex-class3.c
soc.h
sr_device.c ARM: SoC changes for v5.13 2021-04-26 11:48:26 -07:00
sram.c ARM: omap: fix address space warnings from sparse 2022-04-29 09:53:28 +02:00
sram.h ARM: omap: un-merge plat/sram.c 2022-04-22 11:08:55 +02:00
sram242x.S
sram243x.S
ti81xx-restart.c
ti81xx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
timer.c ARM: OMAP2+: Fix memory leak in realtime_counter_init() 2023-03-10 09:32:32 +01:00
usb-tusb6010.c
usb.h
vc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 1) 2022-06-10 14:51:35 +02:00
vc.h
vc3xxx_data.c
vc44xx_data.c
voltage.c
voltage.h
voltagedomains2xxx_data.c
voltagedomains3xxx_data.c
voltagedomains44xx_data.c
voltagedomains54xx_data.c ARM: OMAP2+: Replace HTTP links with HTTPS ones 2020-08-19 10:19:13 +03:00
vp.c
vp.h
vp3xxx_data.c
vp44xx_data.c
wd_timer.c
wd_timer.h