From: Alexander Graf Date: Fri, 8 Oct 2021 05:46:16 +0000 (+0200) Subject: hvf: Determine slot count from struct layout X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=dec490db8b5c98d60814d07c23ddf70708a56d6e;p=qemu.git hvf: Determine slot count from struct layout 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 Reviewed-by: Richard Henderson Message-Id: <20211008054616.43828-1-agraf@csgraf.de> Signed-off-by: Paolo Bonzini --- 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;