Received: from eggs.gnu.org ([140.186.70.92]:34618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRU3V-0006xw-Ds for qemu-devel@nongnu.org; Tue, 31 May 2011 14:52:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRU3T-0005jE-LB for qemu-devel@nongnu.org; Tue, 31 May 2011 14:52:41 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:48307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRU3T-0005j7-3d for qemu-devel@nongnu.org; Tue, 31 May 2011 14:52:39 -0400 Message-Id: <43FF61BA-7388-4EBB-A9E4-571F252F4F97@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: <1306862938-13431-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v936) Date: Tue, 31 May 2011 20:52:35 +0200 References: <1306862938-13431-1-git-send-email-peter.maydell@linaro.org> Sender: andreas.faerber@web.de Subject: Re: [Qemu-devel] [PATCH] audio: fix integer overflow expression List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: =?ISO-8859-1?Q?Juha_Riihim=E4ki?= , Riku Voipio , QEMU Developers , patches@linaro.org Am 31.05.2011 um 19:28 schrieb Peter Maydell: > From: Juha Riihim=E4ki > > Fix an integer overflow that can happen for signed 32 bit types > when using FLOAT_MIXENG. (Note that at the moment this is only true > when using the MacOSX coreaudio audio driver.) > Missing Riku's SoB compared to the link you gave below! > Signed-off-by: Juha Riihim=E4ki > Reviewed-by: Peter Maydell > --- > I'm trying to get random patches out of my patch-stack and upstream. > This one looks "obviously correct" but it only kicks in for MacOSX > and coreaudio, and I don't have access to that platform to test =20 > myself, > so treat my reviewed-by accordingly. The warnings I get on v10.5 ppc64 are as follows: CC audio/mixeng.o In file included from /Users/andreas/QEMU/qemu/audio/mixeng.c:112: /Users/andreas/QEMU/qemu/audio/mixeng_template.h: In function =20 =91conv_natural_int32_t=92: /Users/andreas/QEMU/qemu/audio/mixeng_template.h:49: warning: integer =20= overflow in expression /Users/andreas/QEMU/qemu/audio/mixeng_template.h: In function =20 =91clip_natural_int32_t=92: /Users/andreas/QEMU/qemu/audio/mixeng_template.h:66: warning: integer =20= overflow in expression In file included from /Users/andreas/QEMU/qemu/audio/mixeng.c:117: /Users/andreas/QEMU/qemu/audio/mixeng_template.h: In function =20 =91conv_swap_int32_t=92: /Users/andreas/QEMU/qemu/audio/mixeng_template.h:49: warning: integer =20= overflow in expression /Users/andreas/QEMU/qemu/audio/mixeng_template.h: In function =20 =91clip_swap_int32_t=92: /Users/andreas/QEMU/qemu/audio/mixeng_template.h:66: warning: integer =20= overflow in expression I confirm that this patch silences these. Will test the new patch =20 right away. > This has actually been posted here before, last year: > http://patchwork.ozlabs.org/patch/48703/ That patch clearly shows that dumping a large and unrelated patch =20 series onto the mailing list without cc'ing people and never following =20= them up is not a winning strategy. Andreas > audio/mixeng_template.h | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h > index a2d0ef8..e01da0a 100644 > --- a/audio/mixeng_template.h > +++ b/audio/mixeng_template.h > @@ -46,7 +46,7 @@ static mixeng_real inline glue (conv_, ET) (IN_T v) > #endif > #else /* !RECIPROCAL */ > #ifdef SIGNED > - return nv / (mixeng_real) (IN_MAX - IN_MIN); > + return nv / (mixeng_real) ((mixeng_real)IN_MAX - =20 > (mixeng_real)IN_MIN); > #else > return (nv - HALF) / (mixeng_real) IN_MAX; > #endif > @@ -63,7 +63,7 @@ static IN_T inline glue (clip_, ET) (mixeng_real v) > } > > #ifdef SIGNED > - return ENDIAN_CONVERT ((IN_T) (v * (IN_MAX - IN_MIN))); > + return ENDIAN_CONVERT ((IN_T) (v * ((mixeng_real)IN_MAX - =20 > (mixeng_real)IN_MIN))); > #else > return ENDIAN_CONVERT ((IN_T) ((v * IN_MAX) + HALF)); > #endif > --=20 > 1.7.1 >