]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/loongarch: fix bad shift in check_ps()
authorSong Gao <gaosong@loongson.cn>
Fri, 21 Mar 2025 01:13:58 +0000 (09:13 +0800)
committerBibo Mao <maobibo@loongson.cn>
Fri, 21 Mar 2025 03:31:56 +0000 (11:31 +0800)
commitb8d5503a3ecf8bcf75e4960d04215f71dbfd5dd2
tree5f4fbe330a5987c660d2db79a134338d93dcb97a
parent1267e1ddeb65db5405405adb711272133fe9c670
target/loongarch: fix bad shift in check_ps()

In expression 1ULL << tlb_ps, left shifting by more than 63 bits has
undefined behavior. The shift amount, tlb_ps, is as much as 64. check
"tlb_ps >=64" to fix.

Resolves: Coverity CID 1593475

Fixes: d882c284a3 ("target/loongarch: check tlb_ps")
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
target/loongarch/internals.h
target/loongarch/tcg/csr_helper.c
target/loongarch/tcg/tlb_helper.c