diff options
author | James Morse <james.morse@arm.com> | 2020-06-22 11:33:14 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2020-07-05 18:20:45 +0100 |
commit | 04343ae312ef0d80d601ea1b784b6b039ae9c82a (patch) | |
tree | 4848dd3da5a2989c6fe90cde9fc464f6c1aac4da /arch/arm64/kvm/sys_regs.c | |
parent | 6b33e0d64f8501b51d32069e08d3ed68c58c25b4 (diff) | |
download | lwn-04343ae312ef0d80d601ea1b784b6b039ae9c82a.tar.gz lwn-04343ae312ef0d80d601ea1b784b6b039ae9c82a.zip |
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 <james.morse@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200622113317.20477-3-james.morse@arm.com
Diffstat (limited to 'arch/arm64/kvm/sys_regs.c')
-rw-r--r-- | arch/arm64/kvm/sys_regs.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 6333a7cd92d3..fb448bfc83ec 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -2809,7 +2809,10 @@ static int walk_sys_regs(struct kvm_vcpu *vcpu, u64 __user *uind) i2 = sys_reg_descs; end2 = sys_reg_descs + ARRAY_SIZE(sys_reg_descs); - BUG_ON(i1 == end1 || i2 == end2); + if (i1 == end1) + i1 = NULL; + + BUG_ON(i2 == end2); /* Walk carefully, as both tables may refer to the same register. */ while (i1 || i2) { |