hvf: Determine slot count from struct layout
PATCH 1/1 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 <[email protected]>
--- accel/hvf/hvf-accel-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accel/hvf/hvf-accel-ops.c +1 -1
@@ -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;
Signature · 1 line
2.30.1 (Apple Git-130)
Quoted 10 lines · Alexander Graf
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<[email protected]>--- accel/hvf/hvf-accel-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Richard Henderson <[email protected]>
r~
Paolo Bonzini
AppliedQuoted 17 lines · Alexander Graf
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 <[email protected]>--- accel/hvf/hvf-accel-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)accel/hvf/hvf-accel-ops.c +0
-0
accel/hvf/hvf-accel-ops.c static int hvf_accel_init(MachineState *ms) · line 327
Quoted 8 lines
accel/hvf/hvf-accel-ops.c +1
-1@@ -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;
Queued, thanks.
Paolo