From: gerben@altlinux.org
To: qemu-devel@nongnu.org, richard.henderson@linaro.org
Subject: [PATCH] hw/display: refine upper limit for offset value in assert check
Date: Tue, 22 Jul 2025 14:17:47 +0300 [thread overview]
Message-ID: <20250722111917.19584-1-gerben@altlinux.org> (raw)
From: Denis Rastyogin <gerben@altlinux.org>
Accessing s->core_registers (size 236) could overflow
if the offset goes beyond the valid range.
Since the memory region matches core_registers size exactly,
guest cannot write out-of-bounds.
Therefore, the debug assert has been refined to ensure the offset
remains within DP_CORE_REG_ARRAY_SIZE, preventing internal errors.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Reported-by: David Meliksetyan <d.meliksetyan@fobos-nt.ru>
Signed-off-by: Denis Rastyogin <gerben@altlinux.org>
---
hw/display/xlnx_dp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index 7c980ee642..b35ee2f869 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -896,7 +896,11 @@ static void xlnx_dp_write(void *opaque, hwaddr offset, uint64_t value,
xlnx_dp_update_irq(s);
break;
default:
- assert(offset <= (0x504C >> 2));
+ /*
+ * Check to ensure the offset is within the bounds of
+ * the core_registers[] array.
+ */
+ assert(offset < DP_CORE_REG_ARRAY_SIZE);
s->core_registers[offset] = value;
break;
}
--
2.42.2
next reply other threads:[~2025-07-22 11:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 11:17 gerben [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-12-12 11:45 [PATCH] hw/display: refine upper limit for offset value in assert check gerben
2024-12-12 14:49 ` Richard Henderson
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=20250722111917.19584-1-gerben@altlinux.org \
--to=gerben@altlinux.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 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.