aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/process.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index e7b0b385fb2b..b160ea30de0f 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -311,12 +311,19 @@ static inline int is_sp_move_ins(union mips_instruction *ip)
311static int get_frame_info(struct mips_frame_info *info) 311static int get_frame_info(struct mips_frame_info *info)
312{ 312{
313 union mips_instruction *ip = info->func; 313 union mips_instruction *ip = info->func;
314 int i, max_insns = 314 unsigned max_insns = info->func_size / sizeof(union mips_instruction);
315 min(128UL, info->func_size / sizeof(union mips_instruction)); 315 unsigned i;
316 316
317 info->pc_offset = -1; 317 info->pc_offset = -1;
318 info->frame_size = 0; 318 info->frame_size = 0;
319 319
320 if (!ip)
321 goto err;
322
323 if (max_insns == 0)
324 max_insns = 128U; /* unknown function size */
325 max_insns = min(128U, max_insns);
326
320 for (i = 0; i < max_insns; i++, ip++) { 327 for (i = 0; i < max_insns; i++, ip++) {
321 328
322 if (is_jal_jalr_jr_ins(ip)) 329 if (is_jal_jalr_jr_ins(ip))
@@ -337,6 +344,7 @@ static int get_frame_info(struct mips_frame_info *info)
337 if (info->pc_offset < 0) /* leaf */ 344 if (info->pc_offset < 0) /* leaf */
338 return 1; 345 return 1;
339 /* prologue seems boggus... */ 346 /* prologue seems boggus... */
347err:
340 return -1; 348 return -1;
341} 349}
342 350