From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
marcandre.lureau@redhat.com,
"Chad Jablonski" <chad@jablonski.xyz>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v5 4/8] ati-vga: Avoid warnings about sign extension
Date: Sat, 21 Mar 2026 02:04:22 +0100 (CET) [thread overview]
Message-ID: <9a3263a06bc72aa5a56bafe0a11ad189d5f60528.1774054635.git.balaton@eik.bme.hu> (raw)
In-Reply-To: <cover.1774054635.git.balaton@eik.bme.hu>
Coverity reports several possible sign extension errors (latest is CID
1645615). These cannot happen because the values are limited when
writing the registers and only 32 bits of the return value matter but
change type of the variable storing the return value to uint32_t to
avoid these warnings. Also change DEFAULT_SC_BOTTOM_RIGHT register
read to match what other similar registers do for consistency.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/display/ati.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/display/ati.c b/hw/display/ati.c
index 8286f67c1c..705e4db6e4 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -266,7 +266,7 @@ static void ati_vga_vblank_irq(void *opaque)
ati_vga_update_irq(s);
}
-static inline uint64_t ati_reg_read_offs(uint32_t reg, int offs,
+static inline uint32_t ati_reg_read_offs(uint32_t reg, int offs,
unsigned int size)
{
if (offs == 0 && size == 4) {
@@ -279,7 +279,7 @@ static inline uint64_t ati_reg_read_offs(uint32_t reg, int offs,
static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
{
ATIVGAState *s = opaque;
- uint64_t val = 0;
+ uint32_t val = 0;
switch (addr) {
case MM_INDEX:
@@ -514,8 +514,8 @@ 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) |
- s->regs.default_sc_right;
+ val = s->regs.default_sc_right;
+ val |= s->regs.default_sc_bottom << 16;
break;
case SC_TOP:
val = s->regs.sc_top;
--
2.41.3
next prev parent reply other threads:[~2026-03-21 1:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 1:04 [PATCH v5 0/8] ati-vga fixes BALATON Zoltan
2026-03-21 1:04 ` [PATCH v5 1/8] ati-vga: Fix colors when frame buffer endianness does not match host BALATON Zoltan
2026-03-21 1:04 ` [PATCH v5 2/8] ati-vga: Also switch mode on HW cursor enable bit change BALATON Zoltan
2026-03-21 1:04 ` [PATCH v5 3/8] ati-vga: Do not add crtc offset to src and dst data address BALATON Zoltan
2026-03-21 1:04 ` BALATON Zoltan [this message]
2026-03-21 1:04 ` [PATCH v5 5/8] ati-vga: Fix display updates in non-32 bit modes BALATON Zoltan
2026-03-21 1:04 ` [PATCH v5 6/8] ati-vga: Add work around for fuloong2e BALATON Zoltan
2026-03-21 1:04 ` [PATCH v5 7/8] ati-vga: Fix mouse pointer on big endian frame buffer BALATON Zoltan
2026-03-21 1:04 ` [PATCH v5 8/8] ati-vga: Make sure hardware cursor data is within vram BALATON Zoltan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9a3263a06bc72aa5a56bafe0a11ad189d5f60528.1774054635.git.balaton@eik.bme.hu \
--to=balaton@eik.bme.hu \
--cc=chad@jablonski.xyz \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox