From: WANG Xuerui <[email protected]>
Hi,
While trying to add loongarch to the Rust kvm-bindings crate, I
accidentally discovered faulty logic in the handling of CPUCFG IDs
("leaves" for those more familiar with x86), that could result in
incorrectly accepting every possible int for the ID; fortunately it is
6.8 material that hasn't seen a release yet, so a fix is possible.
The first two patches contain the fix, while the rest are general
drive-by refactoring and comment cleanups.
(As it is currently the Chinese holiday season, it is probably best for
this series to go through the kvm tree, instead of the loongarch one
even though they seem to like prefer collecting every loongarch patch.)
v2 changes:
- Squashed the v1 patches 4 and 5 according to Huacai's review
- Reworded comments according to Huacai's suggestion
- Use WARN_ON_ONCE (instead of BUG) to replace unreachable() for not
crashing the kernel (per checkpatch.pl suggestion)
WANG Xuerui (4):
KVM: LoongArch: Fix input value checking of _kvm_get_cpucfg
KVM: LoongArch: Fix kvm_check_cpucfg incorrectly accepting bad CPUCFG
IDs
KVM: LoongArch: Rename _kvm_get_cpucfg to _kvm_get_cpucfg_mask
KVM: LoongArch: Streamline kvm_check_cpucfg and improve comments
arch/loongarch/kvm/vcpu.c | 68 ++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 41 deletions(-)
--
2.43.0