ati-vga Coverity fixes
PATCH 1/2 ati-vga: Silence warning about operator precedence
In reply to BALATON ZoltanCoverity 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.
--- hw/display/ati_2d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/ati_2d.c +1 -1
@@ -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;
Signature · 1 line
2.41.3
cover ati-vga Coverity fixes
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(-)
Signature · 1 line
2.41.3
PATCH 2/2 ati-vga: Add upper limit to x-linear-aper-size property
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.
--- hw/display/ati.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/display/ati.c +4 -0
@@ -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 ;
Signature · 1 line
2.41.3
Re: [PATCH 1/2] ati-vga: Silence warning about operator precedence
In reply to BALATON ZoltanQuoted 15 lines · BALATON Zoltan
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 <[email protected]>--- hw/display/ati_2d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/display/ati_2d.c +0
-0
hw/display/ati_2d.c static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx)
Quoted 9 lines
hw/display/ati_2d.c +1
-2@@ -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; --
thanks
-- PMM
Re: [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property
In reply to BALATON ZoltanQuoted 27 lines · BALATON Zoltan
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 <[email protected]>--- hw/display/ati.c | 4 ++++ 1 file changed, 4 insertions(+)hw/display/ati.c +4
-1@@ -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 ; --
Quoted 2 lines
2.41.3
thanks
-- PMM
Re: [PATCH 2/2] ati-vga: Add upper limit to x-linear-aper-size property
In reply to BALATON ZoltanQuoted 9 lines · BALATON Zoltan
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 <[email protected]>--- hw/display/ati.c | 4 ++++ 1 file changed, 4 insertions(+)
Re: [PATCH 1/2] ati-vga: Silence warning about operator precedence
In reply to BALATON ZoltanQuoted 14 lines · BALATON Zoltan
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 <[email protected]>--- hw/display/ati_2d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/display/ati_2d.c +0
-0
hw/display/ati_2d.c static void setup_2d_blt_ctx(const ATIVGAState *s, ATI2DCtx *ctx) · line 94
Quoted 5 lines
hw/display/ati_2d.c +1
-1@@ -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?
Quoted 3 lines
hw/display/ati_2d.c +0
-0ctx->frgd_clr = s->regs.dp_brush_frgd_clr; ctx->palette = s->vga.palette; ctx->dst_offset = s->regs.dst_offset;
Philippe Mathieu-Daudé
AppliedQuoted 5 lines · BALATON Zoltan
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.
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 5 lines · BALATON Zoltan
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 propertyQueued via hw-misc tree, thanks.
Thanks. Could somebody review the cirrus-vga patch too so it could be picked up?
Regards,
BALATON Zoltan
Re: [PATCH 1/2] ati-vga: Silence warning about operator precedence
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
Quoted 9 lines · BALATON Zoltan
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 <[email protected]>--- hw/display/ati_2d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
hw/display/ati_2d.c static void setup_2d_blt_ctx(const ATIVGAState *s, · line 96
Quoted 12 lines
hw/display/ati_2d.c +1
-1@@ -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
Quoted 5 lines
Quoted 3 lines
hw/display/ati_2d.c +0
-0ctx->frgd_clr = s->regs.dp_brush_frgd_clr;ctx->palette = s->vga.palette; ctx->dst_offset = s->regs.dst_offset;
Quoted 11 lines · BALATON Zoltan
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 5 lines · BALATON Zoltan
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 propertyQueued 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.