Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter related functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Zide,

On Mon, Jul 15, 2024 at 03:18:07PM -0700, Chen, Zide wrote:
> Date: Mon, 15 Jul 2024 15:18:07 -0700
> From: "Chen, Zide" <zide.chen@xxxxxxxxx>
> Subject: Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR
>  filter related functions
> 
> On 7/14/2024 9:49 PM, Zhao Liu wrote:
> > @@ -5274,13 +5272,13 @@ void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg)
> >      }
> >  }
> >  
> > -static bool kvm_install_msr_filters(KVMState *s)
> > +static int kvm_install_msr_filters(KVMState *s)
> >  {
> >      uint64_t zero = 0;
> >      struct kvm_msr_filter filter = {
> >          .flags = KVM_MSR_FILTER_DEFAULT_ALLOW,
> >      };
> > -    int r, i, j = 0;
> > +    int ret, i, j = 0;
> >  
> >      for (i = 0; i < KVM_MSR_FILTER_MAX_RANGES; i++) {
> 
> Nit: Since it's a clean up patch, how about replace
> KVM_MSR_FILTER_MAX_RANGES with ARRAY_SIZE(msr_handlers), to make the
> code consistent in other places to refer to the array size of
> msr_handlers[].

Yes, that's fine, I'll add a new small trivial patch to clean up this.

> >          KVMMSRHandlers *handler = &msr_handlers[i];
> > @@ -5304,18 +5302,18 @@ static bool kvm_install_msr_filters(KVMState *s)
> >          }
> >      }
> >  
> > -    r = kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter);
> > -    if (r) {
> > -        return false;
> > +    ret = kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter);
> > +    if (ret) {
> > +        return ret;
> >      }
> >  
> > -    return true;
> > +    return 0;
> >  }
> 
> Nit: Seems ret is not needed here, and can directly return kvm_vm_ioctl();

Yes, good catch!

Thanks for you review!
Zhao






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux