Skip to content

Commit b745962

Browse files
jpoimboePeter Zijlstra
authored andcommitted
objtool: Fix error handling inconsistencies in check()
Make sure all fatal errors are funneled through the 'out' label with a negative ret. Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Brendan Jackman <[email protected]> Link: https://lore.kernel.org/r/0f49d6a27a080b4012e84e6df1e23097f44cc082.1741975349.git.jpoimboe@kernel.org
1 parent 8085fcd commit b745962

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/objtool/check.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4605,8 +4605,10 @@ int check(struct objtool_file *file)
46054605
init_cfi_state(&force_undefined_cfi);
46064606
force_undefined_cfi.force_undefined = true;
46074607

4608-
if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3)))
4608+
if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3))) {
4609+
ret = -1;
46094610
goto out;
4611+
}
46104612

46114613
cfi_hash_add(&init_cfi);
46124614
cfi_hash_add(&func_cfi);
@@ -4623,7 +4625,7 @@ int check(struct objtool_file *file)
46234625
if (opts.retpoline) {
46244626
ret = validate_retpoline(file);
46254627
if (ret < 0)
4626-
return ret;
4628+
goto out;
46274629
warnings += ret;
46284630
}
46294631

@@ -4659,7 +4661,7 @@ int check(struct objtool_file *file)
46594661
*/
46604662
ret = validate_unrets(file);
46614663
if (ret < 0)
4662-
return ret;
4664+
goto out;
46634665
warnings += ret;
46644666
}
46654667

@@ -4722,7 +4724,7 @@ int check(struct objtool_file *file)
47224724
if (opts.prefix) {
47234725
ret = add_prefix_symbols(file);
47244726
if (ret < 0)
4725-
return ret;
4727+
goto out;
47264728
warnings += ret;
47274729
}
47284730

0 commit comments

Comments
 (0)