qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ido Plat <ido.plat1@ibm.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Ido Plat <ido.plat1@ibm.com>
Subject: [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction
Date: Fri, 25 Oct 2024 13:48:38 +1100	[thread overview]
Message-ID: <20241025024909.799989-1-ido.plat1@ibm.com> (raw)

Pass the stage size to step function callback,
otherwise do_setm would hang when size is larger then page size because stage size would underflow.
This fix changes do_setm to be more inline with do_setp.

Fixes: 0e92818887dee ("target/arm: Implement the SET* instructions")
Signed-off-by: Ido Plat <ido.plat1@ibm.com>
---
 target/arm/tcg/helper-a64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
index 56b431faf5..8f42a28d07 100644
--- a/target/arm/tcg/helper-a64.c
+++ b/target/arm/tcg/helper-a64.c
@@ -1348,7 +1348,7 @@ static void do_setm(CPUARMState *env, uint32_t syndrome, uint32_t mtedesc,
     /* Do the actual memset: we leave the last partial page to SETE */
     stagesetsize = setsize & TARGET_PAGE_MASK;
     while (stagesetsize > 0) {
-        step = stepfn(env, toaddr, setsize, data, memidx, &mtedesc, ra);
+        step = stepfn(env, toaddr, stagesetsize, data, memidx, &mtedesc, ra);
         toaddr += step;
         setsize -= step;
         stagesetsize -= step;
-- 
2.43.0



             reply	other threads:[~2024-10-25  4:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25  2:48 Ido Plat [this message]
2024-10-25 15:13 ` [PATCH 1/1] target/arm: Fix arithmetic underflow in SETM instruction Richard Henderson
2024-10-25 15:50 ` Michael Tokarev
2024-10-28 15:32   ` Peter Maydell

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=20241025024909.799989-1-ido.plat1@ibm.com \
    --to=ido.plat1@ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).