From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0rVJ-0002pM-5N for qemu-devel@nongnu.org; Mon, 23 Nov 2015 08:50:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0rVF-0003s7-U8 for qemu-devel@nongnu.org; Mon, 23 Nov 2015 08:50:01 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:33287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0rVF-0003rw-OD for qemu-devel@nongnu.org; Mon, 23 Nov 2015 08:49:57 -0500 Received: by wmec201 with SMTP id c201so161468317wme.0 for ; Mon, 23 Nov 2015 05:49:57 -0800 (PST) Sender: Richard Henderson References: <1448282741-22897-1-git-send-email-rth@twiddle.net> <1448282741-22897-2-git-send-email-rth@twiddle.net> <56531199.8010508@weilnetz.de> From: Richard Henderson Message-ID: <56531980.1040104@twiddle.net> Date: Mon, 23 Nov 2015 14:49:52 +0100 MIME-Version: 1.0 In-Reply-To: <56531199.8010508@weilnetz.de> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL for-2.5] tcg: Fix highwater check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, John Clarke On 11/23/2015 02:16 PM, Stefan Weil wrote: > Am 23.11.2015 um 13:45 schrieb Richard Henderson: >> From: John Clarke >> >> 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 >> Signed-off-by: Richard Henderson >> --- >> 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? Of course. Particularly since these really are pointers into the same allocated object. That's 100% ANSI C. > code_gen_highwater should be fixed anyway because > in translate-all a difference is calculated with it. Yes, but we freely make use of this gcc extension in many places. r~