diff mbox

[2/2] cg3: add explicit ram_addr_t cast to scanline page variable

Message ID 1493624375-12707-3-git-send-email-mark.cave-ayland@ilande.co.uk
State New
Headers show

Commit Message

Mark Cave-Ayland May 1, 2017, 7:39 a.m. UTC
Coverity warns that multiplying two 32-bit values gives a 32-bit result which
is assigned to a 64-bit variable. Add an explicit ram_addr_t cast to silence
the warning.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/display/cg3.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé May 1, 2017, 9:43 p.m. UTC | #1
On 05/01/2017 04:39 AM, Mark Cave-Ayland wrote:
> Coverity warns that multiplying two 32-bit values gives a 32-bit result which
> is assigned to a 64-bit variable. Add an explicit ram_addr_t cast to silence
> the warning.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  hw/display/cg3.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/display/cg3.c b/hw/display/cg3.c
> index 03d9197..7ef8a96 100644
> --- a/hw/display/cg3.c
> +++ b/hw/display/cg3.c
> @@ -113,7 +113,7 @@ static void cg3_update_display(void *opaque)
>      for (y = 0; y < height; y++) {
>          int update = s->full_update;
>
> -        page = y * width;
> +        page = (ram_addr_t)y * width;
>          update |= memory_region_get_dirty(&s->vram_mem, page, width,
>                                            DIRTY_MEMORY_VGA);
>          if (update) {
>
diff mbox

Patch

diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index 03d9197..7ef8a96 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -113,7 +113,7 @@  static void cg3_update_display(void *opaque)
     for (y = 0; y < height; y++) {
         int update = s->full_update;
 
-        page = y * width;
+        page = (ram_addr_t)y * width;
         update |= memory_region_get_dirty(&s->vram_mem, page, width,
                                           DIRTY_MEMORY_VGA);
         if (update) {