aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-06-28 10:58:03 -0400
committerWill Deacon <will.deacon@arm.com>2017-06-30 12:11:28 -0400
commit425e1ed73e6574e4fe186ec82fd37213cbd47df0 (patch)
treef5c1b14561bd44748353c203903539e39bf222c1
parent70a62ad19e40a6b0d9e3a048fe0d0a391d76ad12 (diff)
arm64: fix endianness annotation for 'struct jit_ctx' and friends
struct jit_ctx::image is used the store a pointer to the jitted intructions, which are always little-endian. These instructions are thus correctly converted from native order to little-endian before being stored but the pointer 'image' is declared as for native order values. Fix this by declaring the field as __le32* instead of u32*. Same for the pointer used in jit_fill_hole() to initialize the image. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--arch/arm64/net/bpf_jit_comp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 71f930501ade..bd2ac9912087 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -68,7 +68,7 @@ struct jit_ctx {
68 int idx; 68 int idx;
69 int epilogue_offset; 69 int epilogue_offset;
70 int *offset; 70 int *offset;
71 u32 *image; 71 __le32 *image;
72}; 72};
73 73
74static inline void emit(const u32 insn, struct jit_ctx *ctx) 74static inline void emit(const u32 insn, struct jit_ctx *ctx)
@@ -128,7 +128,7 @@ static inline int bpf2a64_offset(int bpf_to, int bpf_from,
128 128
129static void jit_fill_hole(void *area, unsigned int size) 129static void jit_fill_hole(void *area, unsigned int size)
130{ 130{
131 u32 *ptr; 131 __le32 *ptr;
132 /* We are guaranteed to have aligned memory. */ 132 /* We are guaranteed to have aligned memory. */
133 for (ptr = area; size >= sizeof(u32); size -= sizeof(u32)) 133 for (ptr = area; size >= sizeof(u32); size -= sizeof(u32))
134 *ptr++ = cpu_to_le32(AARCH64_BREAK_FAULT); 134 *ptr++ = cpu_to_le32(AARCH64_BREAK_FAULT);
@@ -871,7 +871,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
871 871
872 /* 2. Now, the actual pass. */ 872 /* 2. Now, the actual pass. */
873 873
874 ctx.image = (u32 *)image_ptr; 874 ctx.image = (__le32 *)image_ptr;
875 ctx.idx = 0; 875 ctx.idx = 0;
876 876
877 build_prologue(&ctx); 877 build_prologue(&ctx);