All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/hppa: prevent overflow in BTLB entry size calculation
@ 2025-07-22 10:18 gerben
  2025-07-22 14:35 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: gerben @ 2025-07-22 10:18 UTC (permalink / raw)
  To: qemu-devel, richard.henderson; +Cc: sdl.qemu

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-14 23:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 10:18 [PATCH] target/hppa: prevent overflow in BTLB entry size calculation gerben
2025-07-22 14:35 ` Richard Henderson
2025-08-14 10:43   ` gerben
2025-08-14 23:24     ` Richard Henderson

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.