diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2023-06-08 07:12:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-13 10:43:00 +0300 |
commit | 7a7f11283392311741a5399672fd2657c7c6ff01 (patch) | |
tree | 7a656f57e209f27eea827e202073631bd9747282 /lib/syscall.c | |
parent | 09cb2a71b2e982015fe0464f28da1ab42b8e6375 (diff) | |
download | linux-7a7f11283392311741a5399672fd2657c7c6ff01.tar.xz |
ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
commit 847fb80cc01a54bc827b02547bb8743bdb59ddab 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: ba20bb126940 ("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>
Diffstat (limited to 'lib/syscall.c')
0 files changed, 0 insertions, 0 deletions