]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
objtool: Fix error handling inconsistencies in check()
authorJosh Poimboeuf <jpoimboe@kernel.org>
Fri, 14 Mar 2025 19:29:00 +0000 (12:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:41:58 +0000 (14:41 +0200)
[ Upstream commit b745962cb97569aad026806bb0740663cf813147 ]

Make sure all fatal errors are funneled through the 'out' label with a
negative ret.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Brendan Jackman <jackmanb@google.com>
Link: https://lore.kernel.org/r/0f49d6a27a080b4012e84e6df1e23097f44cc082.1741975349.git.jpoimboe@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/objtool/check.c

index f5af48502c9c8935f9bbf55cb9e37207553f9412..f8e676a6e6f8e976ee25b65ecd53ebea435119ee 100644 (file)
@@ -4692,8 +4692,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);
@@ -4710,7 +4712,7 @@ int check(struct objtool_file *file)
        if (opts.retpoline) {
                ret = validate_retpoline(file);
                if (ret < 0)
-                       return ret;
+                       goto out;
                warnings += ret;
        }
 
@@ -4746,7 +4748,7 @@ int check(struct objtool_file *file)
                 */
                ret = validate_unrets(file);
                if (ret < 0)
-                       return ret;
+                       goto out;
                warnings += ret;
        }
 
@@ -4809,7 +4811,7 @@ int check(struct objtool_file *file)
        if (opts.prefix) {
                ret = add_prefix_symbols(file);
                if (ret < 0)
-                       return ret;
+                       goto out;
                warnings += ret;
        }