Commit b7d99235 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Daniel Borkmann

nfp: bpf: fix immed relocation for larger offsets

Immed relocation is missing a shift which means for larger
offsets the lower and higher part of the address would be
ORed together.

Fixes: ce4ebfd8 ("nfp: bpf: add helpers for updating immediate instructions")
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarJiong Wang <jiong.wang@netronome.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 035d808f
...@@ -107,7 +107,7 @@ u16 immed_get_value(u64 instr) ...@@ -107,7 +107,7 @@ u16 immed_get_value(u64 instr)
if (!unreg_is_imm(reg)) if (!unreg_is_imm(reg))
reg = FIELD_GET(OP_IMMED_B_SRC, instr); reg = FIELD_GET(OP_IMMED_B_SRC, instr);
return (reg & 0xff) | FIELD_GET(OP_IMMED_IMM, instr); return (reg & 0xff) | FIELD_GET(OP_IMMED_IMM, instr) << 8;
} }
void immed_set_value(u64 *instr, u16 immed) void immed_set_value(u64 *instr, u16 immed)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment