2024-05-23 02:14:09

by zhouquan

[permalink] [raw]
Subject: [PATCH] RISC-V: KVM: Fix incorrect reg_subtype labels in kvm_riscv_vcpu_set_reg_isa_ext function

From: Quan Zhou <[email protected]>

In the function kvm_riscv_vcpu_set_reg_isa_ext, the original code
used incorrect reg_subtype labels KVM_REG_RISCV_SBI_MULTI_EN/DIS.
These have been corrected to KVM_REG_RISCV_ISA_MULTI_EN/DIS respectively.
Although they are numerically equivalent, the actual processing
will not result in errors, but it may lead to ambiguous code semantics.

Signed-off-by: Quan Zhou <[email protected]>
---
arch/riscv/kvm/vcpu_onereg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c
index c676275ea0a0..62874fbca29f 100644
--- a/arch/riscv/kvm/vcpu_onereg.c
+++ b/arch/riscv/kvm/vcpu_onereg.c
@@ -724,9 +724,9 @@ static int kvm_riscv_vcpu_set_reg_isa_ext(struct kvm_vcpu *vcpu,
switch (reg_subtype) {
case KVM_REG_RISCV_ISA_SINGLE:
return riscv_vcpu_set_isa_ext_single(vcpu, reg_num, reg_val);
- case KVM_REG_RISCV_SBI_MULTI_EN:
+ case KVM_REG_RISCV_ISA_MULTI_EN:
return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, true);
- case KVM_REG_RISCV_SBI_MULTI_DIS:
+ case KVM_REG_RISCV_ISA_MULTI_DIS:
return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, false);
default:
return -ENOENT;

base-commit: 29c73fc794c83505066ee6db893b2a83ac5fac63
--
2.34.1



2024-05-23 09:06:24

by Andrew Jones

[permalink] [raw]
Subject: Re: [PATCH] RISC-V: KVM: Fix incorrect reg_subtype labels in kvm_riscv_vcpu_set_reg_isa_ext function

On Thu, May 23, 2024 at 10:13:34AM GMT, [email protected] wrote:
> From: Quan Zhou <[email protected]>
>
> In the function kvm_riscv_vcpu_set_reg_isa_ext, the original code
> used incorrect reg_subtype labels KVM_REG_RISCV_SBI_MULTI_EN/DIS.
> These have been corrected to KVM_REG_RISCV_ISA_MULTI_EN/DIS respectively.
> Although they are numerically equivalent, the actual processing
> will not result in errors, but it may lead to ambiguous code semantics.
>
> Signed-off-by: Quan Zhou <[email protected]>
> ---
> arch/riscv/kvm/vcpu_onereg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c
> index c676275ea0a0..62874fbca29f 100644
> --- a/arch/riscv/kvm/vcpu_onereg.c
> +++ b/arch/riscv/kvm/vcpu_onereg.c
> @@ -724,9 +724,9 @@ static int kvm_riscv_vcpu_set_reg_isa_ext(struct kvm_vcpu *vcpu,
> switch (reg_subtype) {
> case KVM_REG_RISCV_ISA_SINGLE:
> return riscv_vcpu_set_isa_ext_single(vcpu, reg_num, reg_val);
> - case KVM_REG_RISCV_SBI_MULTI_EN:
> + case KVM_REG_RISCV_ISA_MULTI_EN:
> return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, true);
> - case KVM_REG_RISCV_SBI_MULTI_DIS:
> + case KVM_REG_RISCV_ISA_MULTI_DIS:
> return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, false);
> default:
> return -ENOENT;
>
> base-commit: 29c73fc794c83505066ee6db893b2a83ac5fac63
> --
> 2.34.1
>
>

Reviewed-by: Andrew Jones <[email protected]>

2024-05-31 05:42:29

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH] RISC-V: KVM: Fix incorrect reg_subtype labels in kvm_riscv_vcpu_set_reg_isa_ext function

On Thu, May 23, 2024 at 7:43 AM <[email protected]> wrote:
>
> From: Quan Zhou <[email protected]>
>
> In the function kvm_riscv_vcpu_set_reg_isa_ext, the original code
> used incorrect reg_subtype labels KVM_REG_RISCV_SBI_MULTI_EN/DIS.
> These have been corrected to KVM_REG_RISCV_ISA_MULTI_EN/DIS respectively.
> Although they are numerically equivalent, the actual processing
> will not result in errors, but it may lead to ambiguous code semantics.
>
> Signed-off-by: Quan Zhou <[email protected]>

Queued this patch for Linux-6.10-rcX fixes.

I have added an appropriate Fixes tag as well.

Thanks,
Anup

> ---
> arch/riscv/kvm/vcpu_onereg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c
> index c676275ea0a0..62874fbca29f 100644
> --- a/arch/riscv/kvm/vcpu_onereg.c
> +++ b/arch/riscv/kvm/vcpu_onereg.c
> @@ -724,9 +724,9 @@ static int kvm_riscv_vcpu_set_reg_isa_ext(struct kvm_vcpu *vcpu,
> switch (reg_subtype) {
> case KVM_REG_RISCV_ISA_SINGLE:
> return riscv_vcpu_set_isa_ext_single(vcpu, reg_num, reg_val);
> - case KVM_REG_RISCV_SBI_MULTI_EN:
> + case KVM_REG_RISCV_ISA_MULTI_EN:
> return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, true);
> - case KVM_REG_RISCV_SBI_MULTI_DIS:
> + case KVM_REG_RISCV_ISA_MULTI_DIS:
> return riscv_vcpu_set_isa_ext_multi(vcpu, reg_num, reg_val, false);
> default:
> return -ENOENT;
>
> base-commit: 29c73fc794c83505066ee6db893b2a83ac5fac63
> --
> 2.34.1
>