On Mon, 9 Mar 2026, Chad Jablonski wrote:
Cast default_sc_bottom to uint32_t before shifting left to prevent
sign extension when assigning to uint64_t.

Fixes: CID 1645615
Signed-off-by: Chad Jablonski <[email protected]>
---
hw/display/ati.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/ati.c b/hw/display/ati.c
index 6cf243bcf9..f9773e1154 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -514,7 +514,7 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, 
unsigned int size)
        val |= s->regs.default_tile << 16;
        break;
    case DEFAULT_SC_BOTTOM_RIGHT:
-        val = (s->regs.default_sc_bottom << 16) |
+        val = ((uint32_t)s->regs.default_sc_bottom << 16) |
              s->regs.default_sc_right;
        break;
    case SC_TOP:

I think this is not needed. This is likely a false positive from Coverity because the valid bits for sc regs are bits 13:0 which we enforce on write so you should not get sign extension here. We typically don't do such fixes for these but mark them in Coverity but cc'd Peter Maydell who knows this better.

Regards,
BALATON Zoltan

Reply via email to