[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202211240038.C8iUWlWw-lkp@intel.com>
Date: Thu, 24 Nov 2022 00:36:54 +0800
From: kernel test robot <lkp@...el.com>
To: Qing Zhang <zhangqing@...ngson.cn>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Huacai Chen <chenhuacai@...nel.org>
Subject: arch/loongarch/kernel/unwind_prologue.c:84 unwind_by_prologue()
warn: unsigned 'frame_ra' is never less than zero.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eb7081409f94a9a8608593d0fb63a1aa3d6f95d8
commit: 49aef111e2dae176a7708b532118f33f24289248 LoongArch: Add prologue unwinder support
date: 3 months ago
config: loongarch-randconfig-m031-20221120
compiler: loongarch64-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
smatch warnings:
arch/loongarch/kernel/unwind_prologue.c:84 unwind_by_prologue() warn: unsigned 'frame_ra' is never less than zero.
vim +/frame_ra +84 arch/loongarch/kernel/unwind_prologue.c
41
42 static bool unwind_by_prologue(struct unwind_state *state)
43 {
44 struct stack_info *info = &state->stack_info;
45 union loongarch_instruction *ip, *ip_end;
46 unsigned long frame_size = 0, frame_ra = -1;
47 unsigned long size, offset, pc = state->pc;
48
49 if (state->sp >= info->end || state->sp < info->begin)
50 return false;
51
52 if (!kallsyms_lookup_size_offset(pc, &size, &offset))
53 return false;
54
55 ip = (union loongarch_instruction *)(pc - offset);
56 ip_end = (union loongarch_instruction *)pc;
57
58 while (ip < ip_end) {
59 if (is_stack_alloc_ins(ip)) {
60 frame_size = (1 << 12) - ip->reg2i12_format.immediate;
61 ip++;
62 break;
63 }
64 ip++;
65 }
66
67 if (!frame_size) {
68 if (state->first)
69 goto first;
70
71 return false;
72 }
73
74 while (ip < ip_end) {
75 if (is_ra_save_ins(ip)) {
76 frame_ra = ip->reg2i12_format.immediate;
77 break;
78 }
79 if (is_branch_ins(ip))
80 break;
81 ip++;
82 }
83
> 84 if (frame_ra < 0) {
85 if (state->first) {
86 state->sp = state->sp + frame_size;
87 goto first;
88 }
89 return false;
90 }
91
92 if (state->first)
93 state->first = false;
94
95 state->pc = *(unsigned long *)(state->sp + frame_ra);
96 state->sp = state->sp + frame_size;
97 return !!__kernel_text_address(state->pc);
98
99 first:
100 state->first = false;
101 if (state->pc == state->ra)
102 return false;
103
104 state->pc = state->ra;
105
106 return !!__kernel_text_address(state->ra);
107 }
108
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (152927 bytes)
Powered by blists - more mailing lists