All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ati-vga Coverity fixes
@ 2026-03-30 21:09 BALATON Zoltan
  2026-03-30 21:09 ` [PATCH 1/2] ati-vga: Silence warning about operator precedence BALATON Zoltan
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: BALATON Zoltan @ 2026-03-30 21:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Philippe Mathieu-Daudé, Peter Maydell

Small patches to address Coverity warnings.

BALATON Zoltan (2):
  ati-vga: Silence warning about operator precedence
  ati-vga: Add upper limit to x-linear-aper-size property

 hw/display/ati.c    | 4 ++++
 hw/display/ati_2d.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.41.3



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] ati-vga: Silence warning about operator precedence
  2026-03-30 21:09 [PATCH 0/2] ati-vga Coverity fixes BALATON Zoltan
@ 2026-03-30 21:09 ` BALATON Zoltan
  2026-03-31  8:04   ` Peter Maydell
  2026-03-31 13:08   ` Philippe Mathieu-Daudé
  2026-03-30 21:09 ` [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property BALATON Zoltan
  2026-03-31 13:09 ` [PATCH 0/2] ati-vga Coverity fixes Philippe Mathieu-Daudé
  2 siblings, 2 replies; 11+ messages in thread
From: BALATON Zoltan @ 2026-03-30 21:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Philippe Mathieu-Daudé, Peter Maydell

Coverity in CID 1645969 warns about possible operator precendence
issue which is a false positive in this case but simplify the
expression to silence the warning.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/display/ati_2d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
index 23527b2c50..9baf6ff37b 100644
--- a/hw/display/ati_2d.c
+++ b/hw/display/ati_2d.c
@@ -91,7 +91,7 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx)
     ctx->host_data_active = s->host_data.active;
     ctx->left_to_right = s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT;
     ctx->top_to_bottom = s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM;
-    ctx->need_swap = HOST_BIG_ENDIAN != s->vga.big_endian_fb ? true : false;
+    ctx->need_swap = (HOST_BIG_ENDIAN != s->vga.big_endian_fb);
     ctx->frgd_clr = s->regs.dp_brush_frgd_clr;
     ctx->palette = s->vga.palette;
     ctx->dst_offset = s->regs.dst_offset;
-- 
2.41.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property
  2026-03-30 21:09 [PATCH 0/2] ati-vga Coverity fixes BALATON Zoltan
  2026-03-30 21:09 ` [PATCH 1/2] ati-vga: Silence warning about operator precedence BALATON Zoltan
@ 2026-03-30 21:09 ` BALATON Zoltan
  2026-03-31  8:05   ` Peter Maydell
  2026-03-31 13:08   ` Philippe Mathieu-Daudé
  2026-03-31 13:09 ` [PATCH 0/2] ati-vga Coverity fixes Philippe Mathieu-Daudé
  2 siblings, 2 replies; 11+ messages in thread
From: BALATON Zoltan @ 2026-03-30 21:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Philippe Mathieu-Daudé, Peter Maydell

Coverity warns in CID 1645968 about possible integer overflow. This
should never happen but to ensure that, add an upper limit on the
x-linear-aper-size. This may not silence the warning but makes sure
users cannot cause an overflow.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/display/ati.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/display/ati.c b/hw/display/ati.c
index fc19737d1f..97d871b1e2 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -1130,6 +1130,10 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
             s->linear_aper_sz = ATI_R100_LINEAR_APER_SIZE;
         }
     }
+    if (s->linear_aper_sz > 256 * MiB) {
+        error_setg(errp, "x-linear-aper-size is too large (maximum 256 MiB)");
+        return;
+    }
     if (s->linear_aper_sz < 16 * MiB) {
         error_setg(errp, "x-linear-aper-size is too small (minimum 16 MiB)");
         return;
-- 
2.41.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ati-vga: Silence warning about operator precedence
  2026-03-30 21:09 ` [PATCH 1/2] ati-vga: Silence warning about operator precedence BALATON Zoltan
@ 2026-03-31  8:04   ` Peter Maydell
  2026-03-31 13:08   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2026-03-31  8:04 UTC (permalink / raw)
  To: BALATON Zoltan
  Cc: qemu-devel, Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Philippe Mathieu-Daudé

On Mon, 30 Mar 2026 at 22:09, BALATON Zoltan <balaton@eik.bme.hu> wrote:
>
> Coverity in CID 1645969 warns about possible operator precendence
> issue which is a false positive in this case but simplify the
> expression to silence the warning.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>  hw/display/ati_2d.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
> index 23527b2c50..9baf6ff37b 100644
> --- a/hw/display/ati_2d.c
> +++ b/hw/display/ati_2d.c
> @@ -91,7 +91,7 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx)
>      ctx->host_data_active = s->host_data.active;
>      ctx->left_to_right = s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT;
>      ctx->top_to_bottom = s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM;
> -    ctx->need_swap = HOST_BIG_ENDIAN != s->vga.big_endian_fb ? true : false;
> +    ctx->need_swap = (HOST_BIG_ENDIAN != s->vga.big_endian_fb);
>      ctx->frgd_clr = s->regs.dp_brush_frgd_clr;
>      ctx->palette = s->vga.palette;
>      ctx->dst_offset = s->regs.dst_offset;
> --

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property
  2026-03-30 21:09 ` [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property BALATON Zoltan
@ 2026-03-31  8:05   ` Peter Maydell
  2026-03-31 13:08   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2026-03-31  8:05 UTC (permalink / raw)
  To: BALATON Zoltan
  Cc: qemu-devel, Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Philippe Mathieu-Daudé

On Mon, 30 Mar 2026 at 22:09, BALATON Zoltan <balaton@eik.bme.hu> wrote:
>
> Coverity warns in CID 1645968 about possible integer overflow. This
> should never happen but to ensure that, add an upper limit on the
> x-linear-aper-size. This may not silence the warning but makes sure
> users cannot cause an overflow.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>  hw/display/ati.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/hw/display/ati.c b/hw/display/ati.c
> index fc19737d1f..97d871b1e2 100644
> --- a/hw/display/ati.c
> +++ b/hw/display/ati.c
> @@ -1130,6 +1130,10 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
>              s->linear_aper_sz = ATI_R100_LINEAR_APER_SIZE;
>          }
>      }
> +    if (s->linear_aper_sz > 256 * MiB) {
> +        error_setg(errp, "x-linear-aper-size is too large (maximum 256 MiB)");
> +        return;
> +    }
>      if (s->linear_aper_sz < 16 * MiB) {
>          error_setg(errp, "x-linear-aper-size is too small (minimum 16 MiB)");
>          return;
> --
> 2.41.3
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property
  2026-03-30 21:09 ` [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property BALATON Zoltan
  2026-03-31  8:05   ` Peter Maydell
@ 2026-03-31 13:08   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-31 13:08 UTC (permalink / raw)
  To: BALATON Zoltan, qemu-devel
  Cc: Gerd Hoffmann, marcandre.lureau, Chad Jablonski, Peter Maydell

On 30/3/26 23:09, BALATON Zoltan wrote:
> Coverity warns in CID 1645968 about possible integer overflow. This
> should never happen but to ensure that, add an upper limit on the
> x-linear-aper-size. This may not silence the warning but makes sure
> users cannot cause an overflow.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/display/ati.c | 4 ++++
>   1 file changed, 4 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ati-vga: Silence warning about operator precedence
  2026-03-30 21:09 ` [PATCH 1/2] ati-vga: Silence warning about operator precedence BALATON Zoltan
  2026-03-31  8:04   ` Peter Maydell
@ 2026-03-31 13:08   ` Philippe Mathieu-Daudé
  2026-03-31 13:44     ` BALATON Zoltan
  1 sibling, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-31 13:08 UTC (permalink / raw)
  To: BALATON Zoltan, qemu-devel
  Cc: Gerd Hoffmann, marcandre.lureau, Chad Jablonski, Peter Maydell

On 30/3/26 23:09, BALATON Zoltan wrote:
> Coverity in CID 1645969 warns about possible operator precendence
> issue which is a false positive in this case but simplify the
> expression to silence the warning.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/display/ati_2d.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
> index 23527b2c50..9baf6ff37b 100644
> --- a/hw/display/ati_2d.c
> +++ b/hw/display/ati_2d.c
> @@ -91,7 +91,7 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx)
>       ctx->host_data_active = s->host_data.active;
>       ctx->left_to_right = s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT;
>       ctx->top_to_bottom = s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM;
> -    ctx->need_swap = HOST_BIG_ENDIAN != s->vga.big_endian_fb ? true : false;
> +    ctx->need_swap = (HOST_BIG_ENDIAN != s->vga.big_endian_fb);

Do we really need the parenthesis?

>       ctx->frgd_clr = s->regs.dp_brush_frgd_clr;
>       ctx->palette = s->vga.palette;
>       ctx->dst_offset = s->regs.dst_offset;



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] ati-vga Coverity fixes
  2026-03-30 21:09 [PATCH 0/2] ati-vga Coverity fixes BALATON Zoltan
  2026-03-30 21:09 ` [PATCH 1/2] ati-vga: Silence warning about operator precedence BALATON Zoltan
  2026-03-30 21:09 ` [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property BALATON Zoltan
@ 2026-03-31 13:09 ` Philippe Mathieu-Daudé
  2026-03-31 13:45   ` BALATON Zoltan
  2 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-31 13:09 UTC (permalink / raw)
  To: BALATON Zoltan, qemu-devel
  Cc: Gerd Hoffmann, marcandre.lureau, Chad Jablonski, Peter Maydell

On 30/3/26 23:09, BALATON Zoltan wrote:
> Small patches to address Coverity warnings.
> 
> BALATON Zoltan (2):
>    ati-vga: Silence warning about operator precedence
>    ati-vga: Add upper limit to x-linear-aper-size property

Queued via hw-misc tree, thanks.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ati-vga: Silence warning about operator precedence
  2026-03-31 13:08   ` Philippe Mathieu-Daudé
@ 2026-03-31 13:44     ` BALATON Zoltan
  0 siblings, 0 replies; 11+ messages in thread
From: BALATON Zoltan @ 2026-03-31 13:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]

On Tue, 31 Mar 2026, Philippe Mathieu-Daudé wrote:
> On 30/3/26 23:09, BALATON Zoltan wrote:
>> Coverity in CID 1645969 warns about possible operator precendence
>> issue which is a false positive in this case but simplify the
>> expression to silence the warning.
>> 
>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>> ---
>>   hw/display/ati_2d.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
>> index 23527b2c50..9baf6ff37b 100644
>> --- a/hw/display/ati_2d.c
>> +++ b/hw/display/ati_2d.c
>> @@ -91,7 +91,7 @@ static void setup_2d_blt_ctx(const ATIVGAState *s, 
>> ATI2DCtx *ctx)
>>       ctx->host_data_active = s->host_data.active;
>>       ctx->left_to_right = s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT;
>>       ctx->top_to_bottom = s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM;
>> -    ctx->need_swap = HOST_BIG_ENDIAN != s->vga.big_endian_fb ? true : 
>> false;
>> +    ctx->need_swap = (HOST_BIG_ENDIAN != s->vga.big_endian_fb);
>
> Do we really need the parenthesis?

Should not be needed but it may be more readable and Coverity warned about 
the original that did not need parenthesis either so it seems the safest 
to write it this way.

Regards,
BALATON Zoltan

>>       ctx->frgd_clr = s->regs.dp_brush_frgd_clr;
>>       ctx->palette = s->vga.palette;
>>       ctx->dst_offset = s->regs.dst_offset;
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] ati-vga Coverity fixes
  2026-03-31 13:09 ` [PATCH 0/2] ati-vga Coverity fixes Philippe Mathieu-Daudé
@ 2026-03-31 13:45   ` BALATON Zoltan
  2026-03-31 17:56     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 11+ messages in thread
From: BALATON Zoltan @ 2026-03-31 13:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

On Tue, 31 Mar 2026, Philippe Mathieu-Daudé wrote:
> On 30/3/26 23:09, BALATON Zoltan wrote:
>> Small patches to address Coverity warnings.
>> 
>> BALATON Zoltan (2):
>>    ati-vga: Silence warning about operator precedence
>>    ati-vga: Add upper limit to x-linear-aper-size property
>
> Queued via hw-misc tree, thanks.

Thanks. Could somebody review the cirrus-vga patch too so it could be 
picked up?

Regards,
BALATON Zoltan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] ati-vga Coverity fixes
  2026-03-31 13:45   ` BALATON Zoltan
@ 2026-03-31 17:56     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-03-31 17:56 UTC (permalink / raw)
  To: BALATON Zoltan
  Cc: qemu-devel, Gerd Hoffmann, marcandre.lureau, Chad Jablonski,
	Peter Maydell

On 31/3/26 15:45, BALATON Zoltan wrote:
> On Tue, 31 Mar 2026, Philippe Mathieu-Daudé wrote:
>> On 30/3/26 23:09, BALATON Zoltan wrote:
>>> Small patches to address Coverity warnings.
>>>
>>> BALATON Zoltan (2):
>>>    ati-vga: Silence warning about operator precedence
>>>    ati-vga: Add upper limit to x-linear-aper-size property
>>
>> Queued via hw-misc tree, thanks.
> 
> Thanks. Could somebody review the cirrus-vga patch too so it could be 
> picked up?

I skipped them because Gerd left a comment.



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-03-31 17:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 21:09 [PATCH 0/2] ati-vga Coverity fixes BALATON Zoltan
2026-03-30 21:09 ` [PATCH 1/2] ati-vga: Silence warning about operator precedence BALATON Zoltan
2026-03-31  8:04   ` Peter Maydell
2026-03-31 13:08   ` Philippe Mathieu-Daudé
2026-03-31 13:44     ` BALATON Zoltan
2026-03-30 21:09 ` [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property BALATON Zoltan
2026-03-31  8:05   ` Peter Maydell
2026-03-31 13:08   ` Philippe Mathieu-Daudé
2026-03-31 13:09 ` [PATCH 0/2] ati-vga Coverity fixes Philippe Mathieu-Daudé
2026-03-31 13:45   ` BALATON Zoltan
2026-03-31 17:56     ` Philippe Mathieu-Daudé

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.