From: gerben@altlinux.org
To: qemu-devel@nongnu.org, richard.henderson@linaro.org
Cc: sdl.qemu@linuxtesting.org
Subject: [PATCH] target/hppa: prevent overflow in BTLB entry size calculation
Date: Tue, 22 Jul 2025 13:18:52 +0300 [thread overview]
Message-ID: <20250722101902.16613-1-gerben@altlinux.org> (raw)
From: Denis Rastyogin <gerben@altlinux.org>
Cast len to long long before multiplying by TARGET_PAGE_SIZE
when calculating btlb->itree.last to ensure 64-bit arithmetic
and avoid potential overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Rastyogin <gerben@altlinux.org>
---
target/hppa/mem_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c
index 9bdd0a6f23..0c196b5bfc 100644
--- a/target/hppa/mem_helper.c
+++ b/target/hppa/mem_helper.c
@@ -766,7 +766,7 @@ void HELPER(diag_btlb)(CPUHPPAState *env)
/* Create new BTLB entry */
btlb->itree.start = virt_page << TARGET_PAGE_BITS;
- btlb->itree.last = btlb->itree.start + len * TARGET_PAGE_SIZE - 1;
+ btlb->itree.last = btlb->itree.start + (long long) len * TARGET_PAGE_SIZE - 1;
btlb->pa = phys_page << TARGET_PAGE_BITS;
set_access_bits_pa11(env, btlb, env->gr[20]);
btlb->t = 0;
--
2.42.2
next reply other threads:[~2025-07-22 10:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 10:18 gerben [this message]
2025-07-22 14:35 ` [PATCH] target/hppa: prevent overflow in BTLB entry size calculation Richard Henderson
2025-08-14 10:43 ` gerben
2025-08-14 23:24 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250722101902.16613-1-gerben@altlinux.org \
--to=gerben@altlinux.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sdl.qemu@linuxtesting.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.