From: Alexander Graf <agraf@csgraf.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>,
Cameron Esfahani <dirty@apple.com>
Subject: [PATCH] hvf: Determine slot count from struct layout
Date: Fri, 8 Oct 2021 07:46:16 +0200 [thread overview]
Message-ID: <20211008054616.43828-1-agraf@csgraf.de> (raw)
We can handle up to a static amount of memory slots, capped by the size of
an internal array.
Let's make sure that array size is the only source of truth for the number
of elements in that array.
Signed-off-by: Alexander Graf <agraf@csgraf.de>
---
accel/hvf/hvf-accel-ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index 6cbd2c3f97..2b2c411076 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -321,7 +321,7 @@ static int hvf_accel_init(MachineState *ms)
s = g_new0(HVFState, 1);
- s->num_slots = 32;
+ s->num_slots = ARRAY_SIZE(s->slots);
for (x = 0; x < s->num_slots; ++x) {
s->slots[x].size = 0;
s->slots[x].slot_id = x;
--
2.30.1 (Apple Git-130)
next reply other threads:[~2021-10-08 5:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 5:46 Alexander Graf [this message]
2021-10-08 11:48 ` [PATCH] hvf: Determine slot count from struct layout Richard Henderson
2021-10-08 17:18 ` Paolo Bonzini
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=20211008054616.43828-1-agraf@csgraf.de \
--to=agraf@csgraf.de \
--cc=dirty@apple.com \
--cc=qemu-devel@nongnu.org \
--cc=r.bolshakov@yadro.com \
/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;
as well as URLs for NNTP newsgroup(s).