qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Richard Henderson <rth@twiddle.net>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, John Clarke <johnc@kirriwa.net>
Subject: Re: [Qemu-devel] [PULL for-2.5] tcg: Fix highwater check
Date: Mon, 23 Nov 2015 14:16:09 +0100	[thread overview]
Message-ID: <56531199.8010508@weilnetz.de> (raw)
In-Reply-To: <1448282741-22897-2-git-send-email-rth@twiddle.net>

Am 23.11.2015 um 13:45 schrieb Richard Henderson:
> From: John Clarke <johnc@kirriwa.net>
> 
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 682af8a..b20ed19 100644
> --- 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;
>          }
>      }
> 

Is a comparison of void pointers portable? Or would it be better
to cast both sides to uintptr_t? Or fix the declaration of
code_gen_highwater to use an uint8_t pointer and cast s->code_ptr
to that type? code_gen_highwater should be fixed anyway because
in translate-all a difference is calculated with it.

Stefan

  reply	other threads:[~2015-11-23 13:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 12:45 [Qemu-devel] [PULL for-2.5] last minute tcg fix Richard Henderson
2015-11-23 12:45 ` [Qemu-devel] [PULL for-2.5] tcg: Fix highwater check Richard Henderson
2015-11-23 13:16   ` Stefan Weil [this message]
2015-11-23 13:49     ` Richard Henderson
2015-11-23 16:07 ` [Qemu-devel] [PULL for-2.5] last minute tcg fix 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=56531199.8010508@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=johnc@kirriwa.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).