Skip to contentSkip to conversation

tcg: Fix info_in_idx increment in layout_arg_by_ref

PATCH In review Richard Henderson 3 participants 4 messages Jul 7, 2023 – Jul 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcg: Fix info_in_idx increment in layout_arg_by_ref

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

Fixes 313bdea84d2 ("tcg: Add TCG_CALL_{RET,ARG}_BY_REF")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751

---
 tcg/tcg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/tcg.c +1 -1
index a0628fe424..652e8ea6b9 100644
@@ -1083,7 +1083,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;
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Richard Henderson

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

Fixes 313bdea84d2 ("tcg: Add TCG_CALL_{RET,ARG}_BY_REF")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751

---
  tcg/tcg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
In reply to Richard Henderson
Quoted 2 lines · Richard Henderson

Off by one error, failing to take into account that layout_arg_1 already incremeneted info_in_idx for the first piece. We only

"incremented"

Quoted 9 lines

need care for the n-1 TCG_CALL_ARG_BY_REF_N pieces here.

Fixes 313bdea84d2 ("tcg: Add TCG_CALL_{RET,ARG}_BY_REF")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751

---
  tcg/tcg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Tested-by on v1 1/1
#3 lore raw
In reply to Richard Henderson
Quoted 10 lines · Richard Henderson

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

Fixes 313bdea84d2 ("tcg: Add TCG_CALL_{RET,ARG}_BY_REF")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751

---

-- PMM