Skip to content

Commit 04343ae

Browse files
James MorseMarc Zyngier
authored andcommitted
KVM: arm64: Tolerate an empty target_table list
Before emptying the target_table lists, and then removing their infrastructure, add some tolerance to an empty list. Instead of bugging-out on an empty list, pretend we already reached the end in the two-list-walk. Signed-off-by: James Morse <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6b33e0d commit 04343ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2809,7 +2809,10 @@ static int walk_sys_regs(struct kvm_vcpu *vcpu, u64 __user *uind)
28092809
i2 = sys_reg_descs;
28102810
end2 = sys_reg_descs + ARRAY_SIZE(sys_reg_descs);
28112811

2812-
BUG_ON(i1 == end1 || i2 == end2);
2812+
if (i1 == end1)
2813+
i1 = NULL;
2814+
2815+
BUG_ON(i2 == end2);
28132816

28142817
/* Walk carefully, as both tables may refer to the same register. */
28152818
while (i1 || i2) {

0 commit comments

Comments
 (0)