diff --git a/tools/objtool/check.c b/tools/objtool/check.c index c18eca151b6d..5b67d6150a0b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2411,13 +2411,6 @@ static int validate_section(struct objtool_file *file, struct section *sec) struct insn_state state; int ret, warnings = 0; - clear_insn_state(&state); - - state.cfa = initial_func_cfi.cfa; - memcpy(&state.regs, &initial_func_cfi.regs, - CFI_NUM_REGS * sizeof(struct cfi_reg)); - state.stack_size = initial_func_cfi.cfa.offset; - list_for_each_entry(func, &sec->symbol_list, list) { if (func->type != STT_FUNC) continue; @@ -2435,6 +2428,12 @@ static int validate_section(struct objtool_file *file, struct section *sec) if (!insn || insn->ignore || insn->visited) continue; + clear_insn_state(&state); + state.cfa = initial_func_cfi.cfa; + memcpy(&state.regs, &initial_func_cfi.regs, + CFI_NUM_REGS * sizeof(struct cfi_reg)); + state.stack_size = initial_func_cfi.cfa.offset; + state.uaccess = func->uaccess_safe; ret = validate_branch(file, func, insn, state);