Skip to content

Commit e8c328d

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: extable: make fixup_exception() return bool
The return values of fixup_exception() and arm64_bpf_fixup_exception() represent a boolean condition rather than an error code, so for clarity it would be better to return `bool` rather than `int`. This patch adjusts the code accordingly. While we're modifying the prototype, we also remove the unnecessary `extern` keyword, so that this won't look out of place when we make subsequent additions to the header. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: James Morse <[email protected]> Cc: Jean-Philippe Brucker <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 819771c commit e8c328d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

arch/arm64/include/asm/extable.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ static inline bool in_bpf_jit(struct pt_regs *regs)
3232
}
3333

3434
#ifdef CONFIG_BPF_JIT
35-
int arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
35+
bool arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
3636
struct pt_regs *regs);
3737
#else /* !CONFIG_BPF_JIT */
3838
static inline
39-
int arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
40-
struct pt_regs *regs)
39+
bool arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
40+
struct pt_regs *regs)
4141
{
42-
return 0;
42+
return false;
4343
}
4444
#endif /* !CONFIG_BPF_JIT */
4545

46-
extern int fixup_exception(struct pt_regs *regs);
46+
bool fixup_exception(struct pt_regs *regs);
4747
#endif

arch/arm64/mm/extable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
#include <linux/extable.h>
77
#include <linux/uaccess.h>
88

9-
int fixup_exception(struct pt_regs *regs)
9+
bool fixup_exception(struct pt_regs *regs)
1010
{
1111
const struct exception_table_entry *fixup;
1212

1313
fixup = search_exception_tables(instruction_pointer(regs));
1414
if (!fixup)
15-
return 0;
15+
return false;
1616

1717
if (in_bpf_jit(regs))
1818
return arm64_bpf_fixup_exception(fixup, regs);
1919

2020
regs->pc = (unsigned long)&fixup->fixup + fixup->fixup;
21-
return 1;
21+
return true;
2222
}

arch/arm64/net/bpf_jit_comp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,15 @@ static void build_epilogue(struct jit_ctx *ctx)
358358
#define BPF_FIXUP_OFFSET_MASK GENMASK(26, 0)
359359
#define BPF_FIXUP_REG_MASK GENMASK(31, 27)
360360

361-
int arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
362-
struct pt_regs *regs)
361+
bool arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
362+
struct pt_regs *regs)
363363
{
364364
off_t offset = FIELD_GET(BPF_FIXUP_OFFSET_MASK, ex->fixup);
365365
int dst_reg = FIELD_GET(BPF_FIXUP_REG_MASK, ex->fixup);
366366

367367
regs->regs[dst_reg] = 0;
368368
regs->pc = (unsigned long)&ex->fixup - offset;
369-
return 1;
369+
return true;
370370
}
371371

372372
/* For accesses to BTF pointers, add an entry to the exception table */

0 commit comments

Comments
 (0)