lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 03 Mar 2020 16:43:51 +0100
From:   Vitaly Kuznetsov <vkuznets@...hat.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, Xiaoyao Li <xiaoyao.li@...el.com>
Subject: Re: [PATCH v2 26/66] KVM: x86: Replace bare "unsigned" with "unsigned int" in cpuid helpers

Sean Christopherson <sean.j.christopherson@...el.com> writes:

> Replace "unsigned" with "unsigned int" to make checkpatch and people
> everywhere a little bit happier, and to avoid propagating the filth when
> future patches add more cpuid helpers that work with unsigned (ints).
>
> No functional change intended.
>
> Suggested-by: Vitaly Kuznetsov <vkuznets@...hat.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> ---
>  arch/x86/kvm/cpuid.h | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
> index 72a79bdfed6b..46b4b61b6cf8 100644
> --- a/arch/x86/kvm/cpuid.h
> +++ b/arch/x86/kvm/cpuid.h
> @@ -63,7 +63,7 @@ static const struct cpuid_reg reverse_cpuid[] = {
>   * and can't be used by KVM to query/control guest capabilities.  And obviously
>   * the leaf being queried must have an entry in the lookup table.
>   */
> -static __always_inline void reverse_cpuid_check(unsigned x86_leaf)
> +static __always_inline void reverse_cpuid_check(unsigned int x86_leaf)
>  {
>  	BUILD_BUG_ON(x86_leaf == CPUID_LNX_1);
>  	BUILD_BUG_ON(x86_leaf == CPUID_LNX_2);
> @@ -87,15 +87,16 @@ static __always_inline u32 __feature_bit(int x86_feature)
>  
>  #define feature_bit(name)  __feature_bit(X86_FEATURE_##name)
>  
> -static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned x86_feature)
> +static __always_inline struct cpuid_reg x86_feature_cpuid(unsigned int x86_feature)
>  {
> -	unsigned x86_leaf = x86_feature / 32;
> +	unsigned int x86_leaf = x86_feature / 32;
>  
>  	reverse_cpuid_check(x86_leaf);
>  	return reverse_cpuid[x86_leaf];
>  }
>  
> -static __always_inline u32 *guest_cpuid_get_register(struct kvm_vcpu *vcpu, unsigned x86_feature)
> +static __always_inline u32 *guest_cpuid_get_register(struct kvm_vcpu *vcpu,
> +						     unsigned int x86_feature)
>  {
>  	struct kvm_cpuid_entry2 *entry;
>  	const struct cpuid_reg cpuid = x86_feature_cpuid(x86_feature);
> @@ -119,7 +120,8 @@ static __always_inline u32 *guest_cpuid_get_register(struct kvm_vcpu *vcpu, unsi
>  	}
>  }
>  
> -static __always_inline bool guest_cpuid_has(struct kvm_vcpu *vcpu, unsigned x86_feature)
> +static __always_inline bool guest_cpuid_has(struct kvm_vcpu *vcpu,
> +					    unsigned int x86_feature)
>  {
>  	u32 *reg;
>  
> @@ -130,7 +132,8 @@ static __always_inline bool guest_cpuid_has(struct kvm_vcpu *vcpu, unsigned x86_
>  	return *reg & __feature_bit(x86_feature);
>  }
>  
> -static __always_inline void guest_cpuid_clear(struct kvm_vcpu *vcpu, unsigned x86_feature)
> +static __always_inline void guest_cpuid_clear(struct kvm_vcpu *vcpu,
> +					      unsigned int x86_feature)
>  {
>  	u32 *reg;

I am a little bit happier indeed, thank you! We still have 170+ bare
unsigned-s in arch/x86/kvm but let's at least not add more.

Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>

-- 
Vitaly

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ