Message ID | 015d7c13dc4e1b481abb23a3eaa254e316b7ca53.1688559115.git.gianluca.luparini@bugseng.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen: fix violations of MISRA C:2012 Rule 7.2 | expand |
On 05.07.2023 17:26, Simone Ballarin wrote: > From: Gianluca Luparini <gianluca.luparini@bugseng.com> > > The xen sources contains violations of MISRA C:2012 Rule 7.2 whose > headline states: > "A 'u' or 'U' suffix shall be applied to all integer constants > that are represented in an unsigned type". > > Add the 'U' suffix to integers literals with unsigned type and also to other > literals used in the same contexts or near violations, when their positive > nature is immediately clear. The latter changes are done for the sake of > uniformity. > > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> > Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com> > Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Acked-by: Jan Beulich <jbeulich@suse.com> albeit ... > --- a/xen/arch/x86/hvm/svm/asid.c > +++ b/xen/arch/x86/hvm/svm/asid.c > @@ -16,7 +16,7 @@ void svm_asid_init(const struct cpuinfo_x86 *c) > > /* Check for erratum #170, and leave ASIDs disabled if it's present. */ > if ( !cpu_has_amd_erratum(c, AMD_ERRATUM_170) ) > - nasids = cpuid_ebx(0x8000000A); > + nasids = cpuid_ebx(0x8000000AU); ... I guess it would be nice to also change A to a here, to match ... > --- a/xen/arch/x86/hvm/svm/svm.c > +++ b/xen/arch/x86/hvm/svm/svm.c > @@ -269,9 +269,9 @@ svm_msrbit(unsigned long *msr_bitmap, uint32_t msr) > */ > if ( msr <= 0x1fff ) > msr_bit = msr_bitmap + 0x0000 / BYTES_PER_LONG; > - else if ( (msr >= 0xc0000000) && (msr <= 0xc0001fff) ) > + else if ( (msr >= 0xc0000000U) && (msr <= 0xc0001fffU) ) > msr_bit = msr_bitmap + 0x0800 / BYTES_PER_LONG; > - else if ( (msr >= 0xc0010000) && (msr <= 0xc0011fff) ) > + else if ( (msr >= 0xc0010000U) && (msr <= 0xc0011fffU) ) > msr_bit = msr_bitmap + 0x1000 / BYTES_PER_LONG; > > return msr_bit; > @@ -2539,8 +2539,8 @@ const struct hvm_function_table * __init start_svm(void) > > setup_vmcb_dump(); > > - if ( boot_cpu_data.extended_cpuid_level >= 0x8000000a ) > - svm_feature_flags = cpuid_edx(0x8000000a); > + if ( boot_cpu_data.extended_cpuid_level >= 0x8000000aU ) > + svm_feature_flags = cpuid_edx(0x8000000aU); > > printk("SVM: Supported advanced features:\n"); > ... other (similar and dissimilar) constants used (and adjusted). I guess I'll take the liberty to make this adjustment while committing. Jan
diff --git a/xen/arch/x86/hvm/svm/asid.c b/xen/arch/x86/hvm/svm/asid.c index 09f8c23fd9..56306d1a16 100644 --- a/xen/arch/x86/hvm/svm/asid.c +++ b/xen/arch/x86/hvm/svm/asid.c @@ -16,7 +16,7 @@ void svm_asid_init(const struct cpuinfo_x86 *c) /* Check for erratum #170, and leave ASIDs disabled if it's present. */ if ( !cpu_has_amd_erratum(c, AMD_ERRATUM_170) ) - nasids = cpuid_ebx(0x8000000A); + nasids = cpuid_ebx(0x8000000AU); hvm_asid_init(nasids); } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 59a6e88dff..56cb2f61bb 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -269,9 +269,9 @@ svm_msrbit(unsigned long *msr_bitmap, uint32_t msr) */ if ( msr <= 0x1fff ) msr_bit = msr_bitmap + 0x0000 / BYTES_PER_LONG; - else if ( (msr >= 0xc0000000) && (msr <= 0xc0001fff) ) + else if ( (msr >= 0xc0000000U) && (msr <= 0xc0001fffU) ) msr_bit = msr_bitmap + 0x0800 / BYTES_PER_LONG; - else if ( (msr >= 0xc0010000) && (msr <= 0xc0011fff) ) + else if ( (msr >= 0xc0010000U) && (msr <= 0xc0011fffU) ) msr_bit = msr_bitmap + 0x1000 / BYTES_PER_LONG; return msr_bit; @@ -2539,8 +2539,8 @@ const struct hvm_function_table * __init start_svm(void) setup_vmcb_dump(); - if ( boot_cpu_data.extended_cpuid_level >= 0x8000000a ) - svm_feature_flags = cpuid_edx(0x8000000a); + if ( boot_cpu_data.extended_cpuid_level >= 0x8000000aU ) + svm_feature_flags = cpuid_edx(0x8000000aU); printk("SVM: Supported advanced features:\n");