@@ -137,30 +137,30 @@ NOKPROBE_SYMBOL(synthesize_relcall);
137137 * Returns non-zero if INSN is boostable.
138138 * RIP relative instructions are adjusted at copying time in 64 bits mode
139139 */
140- int can_boost (struct insn * insn , void * addr )
140+ bool can_boost (struct insn * insn , void * addr )
141141{
142142 kprobe_opcode_t opcode ;
143143 insn_byte_t prefix ;
144144 int i ;
145145
146146 if (search_exception_tables ((unsigned long )addr ))
147- return 0 ; /* Page fault may occur on this address. */
147+ return false ; /* Page fault may occur on this address. */
148148
149149 /* 2nd-byte opcode */
150150 if (insn -> opcode .nbytes == 2 )
151151 return test_bit (insn -> opcode .bytes [1 ],
152152 (unsigned long * )twobyte_is_boostable );
153153
154154 if (insn -> opcode .nbytes != 1 )
155- return 0 ;
155+ return false ;
156156
157157 for_each_insn_prefix (insn , i , prefix ) {
158158 insn_attr_t attr ;
159159
160160 attr = inat_get_opcode_attribute (prefix );
161161 /* Can't boost Address-size override prefix and CS override prefix */
162162 if (prefix == 0x2e || inat_is_address_size_prefix (attr ))
163- return 0 ;
163+ return false ;
164164 }
165165
166166 opcode = insn -> opcode .bytes [0 ];
@@ -181,12 +181,12 @@ int can_boost(struct insn *insn, void *addr)
181181 case 0xf6 ... 0xf7 : /* Grp3 */
182182 case 0xfe : /* Grp4 */
183183 /* ... are not boostable */
184- return 0 ;
184+ return false ;
185185 case 0xff : /* Grp5 */
186186 /* Only indirect jmp is boostable */
187187 return X86_MODRM_REG (insn -> modrm .bytes [0 ]) == 4 ;
188188 default :
189- return 1 ;
189+ return true ;
190190 }
191191}
192192
@@ -253,20 +253,18 @@ unsigned long recover_probed_instruction(kprobe_opcode_t *buf, unsigned long add
253253}
254254
255255/* Check if paddr is at an instruction boundary */
256- static int can_probe (unsigned long paddr )
256+ static bool can_probe (unsigned long paddr )
257257{
258258 unsigned long addr , __addr , offset = 0 ;
259259 struct insn insn ;
260260 kprobe_opcode_t buf [MAX_INSN_SIZE ];
261261
262262 if (!kallsyms_lookup_size_offset (paddr , NULL , & offset ))
263- return 0 ;
263+ return false ;
264264
265265 /* Decode instructions */
266266 addr = paddr - offset ;
267267 while (addr < paddr ) {
268- int ret ;
269-
270268 /*
271269 * Check if the instruction has been modified by another
272270 * kprobe, in which case we replace the breakpoint by the
@@ -277,11 +275,10 @@ static int can_probe(unsigned long paddr)
277275 */
278276 __addr = recover_probed_instruction (buf , addr );
279277 if (!__addr )
280- return 0 ;
278+ return false ;
281279
282- ret = insn_decode_kernel (& insn , (void * )__addr );
283- if (ret < 0 )
284- return 0 ;
280+ if (insn_decode_kernel (& insn , (void * )__addr ) < 0 )
281+ return false;
285282
286283#ifdef CONFIG_KGDB
287284 /*
@@ -290,7 +287,7 @@ static int can_probe(unsigned long paddr)
290287 */
291288 if (insn .opcode .bytes [0 ] == INT3_INSN_OPCODE &&
292289 kgdb_has_hit_break (addr ))
293- return 0 ;
290+ return false ;
294291#endif
295292 addr += insn .length ;
296293 }
@@ -310,10 +307,10 @@ static int can_probe(unsigned long paddr)
310307 */
311308 __addr = recover_probed_instruction (buf , addr );
312309 if (!__addr )
313- return 0 ;
310+ return false ;
314311
315312 if (insn_decode_kernel (& insn , (void * )__addr ) < 0 )
316- return 0 ;
313+ return false ;
317314
318315 if (insn .opcode .value == 0xBA )
319316 offset = 12 ;
@@ -324,7 +321,7 @@ static int can_probe(unsigned long paddr)
324321
325322 /* This movl/addl is used for decoding CFI. */
326323 if (is_cfi_trap (addr + offset ))
327- return 0 ;
324+ return false ;
328325 }
329326
330327out :
0 commit comments