Re: [Qemu-devel] [PATCH] hw/ppc/ppc405_uc.c: Avoid integer overflows

2017-02-21 Thread David Gibson
On Tue, Feb 21, 2017 at 01:33:41PM +, Peter Maydell wrote: > When performing clock calculations, the ppc405_uc code > has several places where it multiplies together two > 32-bit variables and assigns the result to a 64-bit > variable. This doesn't quite do what is intended because > C will com

Re: [Qemu-devel] [PATCH] hw/ppc/ppc405_uc.c: Avoid integer overflows

2017-02-21 Thread Philippe Mathieu-Daudé
On 02/21/2017 10:33 AM, Peter Maydell wrote: When performing clock calculations, the ppc405_uc code has several places where it multiplies together two 32-bit variables and assigns the result to a 64-bit variable. This doesn't quite do what is intended because C will compute a 32-bit multiply res

[Qemu-devel] [PATCH] hw/ppc/ppc405_uc.c: Avoid integer overflows

2017-02-21 Thread Peter Maydell
When performing clock calculations, the ppc405_uc code has several places where it multiplies together two 32-bit variables and assigns the result to a 64-bit variable. This doesn't quite do what is intended because C will compute a 32-bit multiply result. Add casts to ensure we don't truncate the