From 74e2e59b8d0a68be0956310fc349179c89fd7be0 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 8 Oct 2018 14:55:05 +0100 Subject: hw/display/bcm2835_fb: Silence Coverity warning about multiply overflow Coverity complains (CID 1395628) that the multiply in the calculation of the framebuffer base is performed as 32x32 but then used in a context that takes a 64-bit hwaddr. This can't actually ever overflow the 32-bit result, because of the constraints placed on the s->config values in bcm2835_fb_validate_config(). But we can placate Coverity anyway, by explicitly casting one of the inputs to a hwaddr, so the whole expression is calculated with 64-bit arithmetic. Signed-off-by: Peter Maydell Reviewed-by: Paolo Bonzini Message-id: 20181005133012.26490-1-peter.maydell@linaro.org --- hw/display/bcm2835_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/display') diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c index d534d00..599863e 100644 --- a/hw/display/bcm2835_fb.c +++ b/hw/display/bcm2835_fb.c @@ -190,7 +190,7 @@ static void fb_update_display(void *opaque) } if (s->invalidate) { - hwaddr base = s->config.base + xoff + yoff * src_width; + hwaddr base = s->config.base + xoff + (hwaddr)yoff * src_width; framebuffer_update_memory_section(&s->fbsection, s->dma_mr, base, s->config.yres, src_width); -- cgit v1.1