]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
LoongArch: BPF: Fix check condition to call lu32id in move_imm()
authorTiezhu Yang <yangtiezhu@loongson.cn>
Fri, 28 Jul 2023 02:30:42 +0000 (10:30 +0800)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:20:56 +0000 (17:20 +0200)
commit5f4fffba782c468b4091ca480dd13db66e9e67b0
tree27f77f83f3524af37129964f8c31352387984a30
parent9f0e60d219bdf818280586669c2b141dc60ddfc3
LoongArch: BPF: Fix check condition to call lu32id in move_imm()

BugLink: https://bugs.launchpad.net/bugs/2037005
commit 4eece7e6de94d833c8aeed2f438faf487cbf94ff upstream.

As the code comment says, the initial aim is to reduce one instruction
in some corner cases, if bit[51:31] is all 0 or all 1, no need to call
lu32id. That is to say, it should call lu32id only if bit[51:31] is not
all 0 and not all 1. The current code always call lu32id, the result is
right but the logic is unexpected and wrong, fix it.

Cc: stable@vger.kernel.org # 6.1
Fixes: 5dc615520c4d ("LoongArch: Add BPF JIT support")
Reported-by: Colin King (gmail) <colin.i.king@gmail.com>
Closes: https://lore.kernel.org/all/bcf97046-e336-712a-ac68-7fd194f2953e@gmail.com/
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
arch/loongarch/net/bpf_jit.h