* [Qemu-devel] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow
@ 2017-02-16 17:26 Peter Maydell
2017-02-17 23:00 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
2017-02-21 10:07 ` [Qemu-devel] " Michael Tokarev
0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2017-02-16 17:26 UTC (permalink / raw)
To: qemu-devel; +Cc: patches, Michael Walle, qemu-trivial
Don't truncate the multiplication and do a 64 bit one instead
because the result is stored in a 64 bit variable.
This fixes a similar coverity warning to commits 237a8650d640 and
4382fa655498, in a similar way, and is the final third of the fix for
coverity CID 1167561 (hopefully!).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Third time lucky -- I checked and this is the last of these
multiply lines.
hw/display/milkymist-tmu2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c
index 7528665..59120dd 100644
--- a/hw/display/milkymist-tmu2.c
+++ b/hw/display/milkymist-tmu2.c
@@ -293,7 +293,7 @@ static void tmu2_start(MilkymistTMU2State *s)
cpu_physical_memory_unmap(mesh, mesh_len, 0, mesh_len);
/* Write back the OpenGL framebuffer to the QEMU framebuffer */
- fb_len = 2 * s->regs[R_DSTHRES] * s->regs[R_DSTVRES];
+ fb_len = 2ULL * s->regs[R_DSTHRES] * s->regs[R_DSTVRES];
fb = cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 1);
if (fb == NULL) {
glDeleteTextures(1, &texture);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow
2017-02-16 17:26 [Qemu-devel] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow Peter Maydell
@ 2017-02-17 23:00 ` Philippe Mathieu-Daudé
2017-02-20 8:41 ` Michael Walle
2017-02-21 10:07 ` [Qemu-devel] " Michael Tokarev
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-02-17 23:00 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, qemu-trivial, Michael Walle, patches
On 02/16/2017 02:26 PM, Peter Maydell wrote:
> Don't truncate the multiplication and do a 64 bit one instead
> because the result is stored in a 64 bit variable.
>
> This fixes a similar coverity warning to commits 237a8650d640 and
> 4382fa655498, in a similar way, and is the final third of the fix for
> coverity CID 1167561 (hopefully!).
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Third time lucky -- I checked and this is the last of these
> multiply lines.
>
> hw/display/milkymist-tmu2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c
> index 7528665..59120dd 100644
> --- a/hw/display/milkymist-tmu2.c
> +++ b/hw/display/milkymist-tmu2.c
> @@ -293,7 +293,7 @@ static void tmu2_start(MilkymistTMU2State *s)
> cpu_physical_memory_unmap(mesh, mesh_len, 0, mesh_len);
>
> /* Write back the OpenGL framebuffer to the QEMU framebuffer */
> - fb_len = 2 * s->regs[R_DSTHRES] * s->regs[R_DSTVRES];
> + fb_len = 2ULL * s->regs[R_DSTHRES] * s->regs[R_DSTVRES];
> fb = cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 1);
> if (fb == NULL) {
> glDeleteTextures(1, &texture);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow
2017-02-17 23:00 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
@ 2017-02-20 8:41 ` Michael Walle
0 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2017-02-20 8:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Peter Maydell, qemu-devel, qemu-trivial, patches,
Philippe Mathieu-Daudé
Am 2017-02-18 00:00, schrieb Philippe Mathieu-Daudé:
> On 02/16/2017 02:26 PM, Peter Maydell wrote:
>> Don't truncate the multiplication and do a 64 bit one instead
>> because the result is stored in a 64 bit variable.
>>
>> This fixes a similar coverity warning to commits 237a8650d640 and
>> 4382fa655498, in a similar way, and is the final third of the fix for
>> coverity CID 1167561 (hopefully!).
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Michael Walle <michael@walle.cc>
>
>> ---
>> Third time lucky -- I checked and this is the last of these
>> multiply lines.
>>
>> hw/display/milkymist-tmu2.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c
>> index 7528665..59120dd 100644
>> --- a/hw/display/milkymist-tmu2.c
>> +++ b/hw/display/milkymist-tmu2.c
>> @@ -293,7 +293,7 @@ static void tmu2_start(MilkymistTMU2State *s)
>> cpu_physical_memory_unmap(mesh, mesh_len, 0, mesh_len);
>>
>> /* Write back the OpenGL framebuffer to the QEMU framebuffer */
>> - fb_len = 2 * s->regs[R_DSTHRES] * s->regs[R_DSTVRES];
>> + fb_len = 2ULL * s->regs[R_DSTHRES] * s->regs[R_DSTVRES];
>> fb = cpu_physical_memory_map(s->regs[R_DSTFBUF], &fb_len, 1);
>> if (fb == NULL) {
>> glDeleteTextures(1, &texture);
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow
2017-02-16 17:26 [Qemu-devel] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow Peter Maydell
2017-02-17 23:00 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
@ 2017-02-21 10:07 ` Michael Tokarev
1 sibling, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2017-02-21 10:07 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: qemu-trivial, Michael Walle, patches
Applied to -trivial, thanks!
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-21 10:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 17:26 [Qemu-devel] [PATCH] lm32: milkymist-tmu2: fix a third integer overflow Peter Maydell
2017-02-17 23:00 ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
2017-02-20 8:41 ` Michael Walle
2017-02-21 10:07 ` [Qemu-devel] " Michael Tokarev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.