Commit b745962c authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Peter Zijlstra
Browse files

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: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarBrendan Jackman <jackmanb@google.com>
Link: https://lore.kernel.org/r/0f49d6a27a080b4012e84e6df1e23097f44cc082.1741975349.git.jpoimboe@kernel.org
parent 8085fcd7
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -4605,8 +4605,10 @@ int check(struct objtool_file *file)
	init_cfi_state(&force_undefined_cfi);
	force_undefined_cfi.force_undefined = true;

	if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3)))
	if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3))) {
		ret = -1;
		goto out;
	}

	cfi_hash_add(&init_cfi);
	cfi_hash_add(&func_cfi);
@@ -4623,7 +4625,7 @@ int check(struct objtool_file *file)
	if (opts.retpoline) {
		ret = validate_retpoline(file);
		if (ret < 0)
			return ret;
			goto out;
		warnings += ret;
	}

@@ -4659,7 +4661,7 @@ int check(struct objtool_file *file)
		 */
		ret = validate_unrets(file);
		if (ret < 0)
			return ret;
			goto out;
		warnings += ret;
	}

@@ -4722,7 +4724,7 @@ int check(struct objtool_file *file)
	if (opts.prefix) {
		ret = add_prefix_symbols(file);
		if (ret < 0)
			return ret;
			goto out;
		warnings += ret;
	}