diff mbox

[06/10] cg3: fix up size parameter for memory_region_get_dirty()

Message ID 20170404102315.24923-7-kraxel@redhat.com
State New, archived
Headers show

Commit Message

Gerd Hoffmann April 4, 2017, 10:23 a.m. UTC
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

The code was incorrectly calculating the end address rather than the size of
the required region.

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

Mark Cave-Ayland April 4, 2017, 12:32 p.m. UTC | #1
On 04/04/17 11:23, Gerd Hoffmann wrote:

> From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> The code was incorrectly calculating the end address rather than the size of
> the required region.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  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 e05ca92..6e19da0 100644
> --- a/hw/display/cg3.c
> +++ b/hw/display/cg3.c
> @@ -115,7 +115,7 @@ static void cg3_update_display(void *opaque)
>          int update = s->full_update;
>  
>          page = y * width;
> -        update |= memory_region_get_dirty(&s->vram_mem, page, page + width,
> +        update |= memory_region_get_dirty(&s->vram_mem, page, width - 1,
>                                            DIRTY_MEMORY_VGA);
>          if (update) {
>              if (y_start < 0) {
> 

The size here should actually be "width" rather than "width - 1" here
(this patch was originally written when the assert()s for checking the
start/end of the region size were off-by-one).


ATB,

Mark.
diff mbox

Patch

diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index e05ca92..6e19da0 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -115,7 +115,7 @@  static void cg3_update_display(void *opaque)
         int update = s->full_update;
 
         page = y * width;
-        update |= memory_region_get_dirty(&s->vram_mem, page, page + width,
+        update |= memory_region_get_dirty(&s->vram_mem, page, width - 1,
                                           DIRTY_MEMORY_VGA);
         if (update) {
             if (y_start < 0) {