diff mbox series

[Stable-8.0.4,14/31] tcg: Fix info_in_idx increment in layout_arg_by_ref

Message ID 20230725134517.3370706-14-mjt@tls.msk.ru
State New
Headers show
Series None | expand

Commit Message

Michael Tokarev July 25, 2023, 1:44 p.m. UTC
From: Richard Henderson <richard.henderson@linaro.org>

Off by one error, failing to take into account that layout_arg_1
already incremented info_in_idx for the first piece.  We only
need care for the n-1 TCG_CALL_ARG_BY_REF_N pieces here.

Cc: qemu-stable@nongnu.org
Fixes: 313bdea84d2 ("tcg: Add TCG_CALL_{RET,ARG}_BY_REF")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit e18ed26ce785f74a17e6f3a095647e08ba6fc669)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff mbox series

Patch

diff --git a/tcg/tcg.c b/tcg/tcg.c
index bb52bc060b..f3bf471274 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -732,7 +732,7 @@  static void layout_arg_by_ref(TCGCumulativeArgs *cum, TCGHelperInfo *info)
             .ref_slot = cum->ref_slot + i,
         };
     }
-    cum->info_in_idx += n;
+    cum->info_in_idx += n - 1;  /* i=0 accounted for in layout_arg_1 */
     cum->ref_slot += n;
 }