nfp: bpf: fix immed relocation for larger offsets

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/b7d99235473ad3a550f8eb05bd4469edadf1c8e6
Commit:     b7d99235473ad3a550f8eb05bd4469edadf1c8e6
Parent:     035d808f7cfd578dc210b584beb17e365f34d39a
Refname:    refs/heads/master
Author:     Jakub Kicinski <[email protected]>
AuthorDate: Wed Feb 7 20:27:12 2018 -0800
Committer:  Daniel Borkmann <[email protected]>
CommitDate: Thu Feb 8 11:59:50 2018 +0100

    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: ce4ebfd859c3 ("nfp: bpf: add helpers for updating immediate instructions")
    Signed-off-by: Jakub Kicinski <[email protected]>
    Reviewed-by: Jiong Wang <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
---
 drivers/net/ethernet/netronome/nfp/nfp_asm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_asm.c b/drivers/net/ethernet/netronome/nfp/nfp_asm.c
index 3f6952b66a49..1e597600c693 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_asm.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_asm.c
@@ -107,7 +107,7 @@ u16 immed_get_value(u64 instr)
 	if (!unreg_is_imm(reg))
 		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)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.