aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorSong Gao <gaosong@loongson.cn>2024-07-24 09:58:53 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2024-07-26 13:12:12 +0300
commit50675777a07395e2ee84e3f2e7c90cf6522ef966 (patch)
tree12ea19a8e59c3043b83f024aac600821697fe8f3 /target
parent9d0076b4a1a49a125ca9567cd4641d07b0447573 (diff)
target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue
When the lddir level is 4 and the base is a HugePage, we may try to put value 4 into a field in the TLBENTRY that is only 2 bits wide. Fixes: Coverity CID 1547717 Fixes: 9c70db9a43388 ("target/loongarch: Fix tlb huge page loading issue") Signed-off-by: Song Gao <gaosong@loongson.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20240724015853.1317396-1-gaosong@loongson.cn> (cherry picked from commit a18ffbcf8b9fabfc6c850ebb1d3e40a21b885c67) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'target')
-rw-r--r--target/loongarch/tcg/tlb_helper.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
index 57f5308632..2262005499 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -524,6 +524,7 @@ target_ulong helper_lddir(CPULoongArchState *env, target_ulong base,
if (unlikely(level == 4)) {
qemu_log_mask(LOG_GUEST_ERROR,
"Attempted use of level 4 huge page\n");
+ return base;
}
if (FIELD_EX64(base, TLBENTRY, LEVEL)) {