tcg: Fix highwater check
authorJohn Clarke <johnc@kirriwa.net>
Thu, 19 Nov 2015 09:30:50 +0000 (10:30 +0100)
committerRichard Henderson <rth@twiddle.net>
Mon, 23 Nov 2015 12:16:05 +0000 (13:16 +0100)
A simple typo in the variable to use when comparing vs the highwater mark.
Reports are that qemu can in fact segfault occasionally due to this mistake.

Signed-off-by: John Clarke <johnc@kirriwa.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg/tcg.c

index 682af8a7c6c415e1f9d34b7f99cffb5523a31aab..b20ed19879344c62dc0ca7e886b2b618e143a9c0 100644 (file)
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2443,7 +2443,7 @@ int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf)
            one operation beginning below the high water mark cannot overrun
            the buffer completely.  Thus we can test for overflow after
            generating code without having to check during generation.  */
-        if (unlikely(s->code_gen_ptr > s->code_gen_highwater)) {
+        if (unlikely((void *)s->code_ptr > s->code_gen_highwater)) {
             return -1;
         }
     }