When build v5.18 kernel, there is below warning reported:
arch/arm64/kernel/perf_regs.c:56:34: warning: array subscript 32 is above
array bounds of 'u64[31]' {aka 'long long unsigned int[31]'} [-Warray-bounds]
   56 |                 return regs->regs[PERF_REG_ARM64_PC];
This issue is introduced by commit 2277d295502a("perf: perf can not
parser the backtrace of app in the 32bit system and 64bit kernel.").
Because it uses the index that is out of array bounds. Therefore, instead
of regs[] with pc to avoid building error.

Signed-off-by: Meng Li <[email protected]>
---
 arch/arm64/kernel/perf_regs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 mode change 100644 => 100755 arch/arm64/kernel/perf_regs.c

diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
old mode 100644
new mode 100755
index d38fddde768d..469d28d26b2f
--- a/arch/arm64/kernel/perf_regs.c
+++ b/arch/arm64/kernel/perf_regs.c
@@ -53,7 +53,7 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
 
        if (perf_reg_abi(current) == PERF_SAMPLE_REGS_ABI_32
                && idx == 15)
-               return regs->regs[PERF_REG_ARM64_PC];
+               return regs->pc;
 
        return regs->regs[idx];
 }
-- 
2.36.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#11293): 
https://lists.yoctoproject.org/g/linux-yocto/message/11293
Mute This Topic: https://lists.yoctoproject.org/mt/91050343/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to