Message ID | 1231f5eeebf6f2e30b91780e92dc4d6015cefdb7.1694532795.git.simone.ballarin@bugseng.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen/x86: address violations of MISRA C:2012 Rule 7.2 | expand |
On Tue, 12 Sep 2023, Simone Ballarin wrote: > 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. > > For the sake of uniformity, the following change is made: > - add 'U' suffixes to 'mask16' in 'stdvga.c' > > 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>
On 12.09.2023 17:38, Simone Ballarin wrote: > 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. > > For the sake of uniformity, the following change is made: > - add 'U' suffixes to 'mask16' in 'stdvga.c' > > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> > Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com> Comparing with v5 - are the two tags in the correct order? And is there a From: Gianluca missing now? Apart from that I'm now okay with the changes presented here. Jan
On 13/09/23 11:44, Jan Beulich wrote: > On 12.09.2023 17:38, Simone Ballarin wrote: >> 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. >> >> For the sake of uniformity, the following change is made: >> - add 'U' suffixes to 'mask16' in 'stdvga.c' >> >> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> >> Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com> > > Comparing with v5 - are the two tags in the correct order? And is there > a From: Gianluca missing now? Apart from that I'm now okay with the > changes presented here. > > Jan > The commit is new and it has been obtained splitting a previous commit made by Luparini. Currently Luparini is not working on that, for this reason I'm the author of the new commit. I thought that the first signed-off tag should be the commit author, this is the reason why I've changed the order.
On 28.09.2023 13:11, Simone Ballarin wrote: > On 13/09/23 11:44, Jan Beulich wrote: >> On 12.09.2023 17:38, Simone Ballarin wrote: >>> 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. >>> >>> For the sake of uniformity, the following change is made: >>> - add 'U' suffixes to 'mask16' in 'stdvga.c' >>> >>> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> >>> Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com> >> >> Comparing with v5 - are the two tags in the correct order? And is there >> a From: Gianluca missing now? Apart from that I'm now okay with the >> changes presented here. > > The commit is new and it has been obtained splitting a previous commit > made by Luparini. Currently Luparini is not working on that, for this > reason I'm the author of the new commit. > > I thought that the first signed-off tag should be the commit author, > this is the reason why I've changed the order. If this patch is a the result of splitting an earlier larger one, then the question still is who made the (initial part of the) changes that are now in here. If it was all you, then I don't see why there's a 2nd SoB. If part came from Gianluca's earlier work, then imo the first SoB still ought to be his. Jan
On 28/09/23 14:01, Jan Beulich wrote: > On 28.09.2023 13:11, Simone Ballarin wrote: >> On 13/09/23 11:44, Jan Beulich wrote: >>> On 12.09.2023 17:38, Simone Ballarin wrote: >>>> 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. >>>> >>>> For the sake of uniformity, the following change is made: >>>> - add 'U' suffixes to 'mask16' in 'stdvga.c' >>>> >>>> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> >>>> Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com> >>> >>> Comparing with v5 - are the two tags in the correct order? And is there >>> a From: Gianluca missing now? Apart from that I'm now okay with the >>> changes presented here. >> >> The commit is new and it has been obtained splitting a previous commit >> made by Luparini. Currently Luparini is not working on that, for this >> reason I'm the author of the new commit. >> >> I thought that the first signed-off tag should be the commit author, >> this is the reason why I've changed the order. > > If this patch is a the result of splitting an earlier larger one, then > the question still is who made the (initial part of the) changes that > are now in here. If it was all you, then I don't see why there's a 2nd > SoB. If part came from Gianluca's earlier work, then imo the first SoB > still ought to be his. > > Jan > Ok.
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 20d266ffd5..eeb73e1aa5 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -129,7 +129,7 @@ int hvm_hypercall(struct cpu_user_regs *regs) break; } - if ( (eax & 0x80000000) && is_viridian_domain(currd) ) + if ( (eax & 0x80000000U) && is_viridian_domain(currd) ) { int ret; diff --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c index 2145c531b6..eb4a455763 100644 --- a/xen/arch/x86/hvm/pmtimer.c +++ b/xen/arch/x86/hvm/pmtimer.c @@ -40,8 +40,8 @@ #define SCI_IRQ 9 /* We provide a 32-bit counter (must match the TMR_VAL_EXT bit in the FADT) */ -#define TMR_VAL_MASK (0xffffffff) -#define TMR_VAL_MSB (0x80000000) +#define TMR_VAL_MASK (0xffffffffU) +#define TMR_VAL_MSB (0x80000000U) /* Dispatch SCIs based on the PM1a_STS and PM1a_EN registers */ static void pmt_update_sci(PMTState *s) diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c index 2586891863..8da07ff8a2 100644 --- a/xen/arch/x86/hvm/stdvga.c +++ b/xen/arch/x86/hvm/stdvga.c @@ -39,22 +39,22 @@ #define PAT(x) (x) static const uint32_t mask16[16] = { - PAT(0x00000000), - PAT(0x000000ff), - PAT(0x0000ff00), - PAT(0x0000ffff), - PAT(0x00ff0000), - PAT(0x00ff00ff), - PAT(0x00ffff00), - PAT(0x00ffffff), - PAT(0xff000000), - PAT(0xff0000ff), - PAT(0xff00ff00), - PAT(0xff00ffff), - PAT(0xffff0000), - PAT(0xffff00ff), - PAT(0xffffff00), - PAT(0xffffffff), + PAT(0x00000000U), + PAT(0x000000ffU), + PAT(0x0000ff00U), + PAT(0x0000ffffU), + PAT(0x00ff0000U), + PAT(0x00ff00ffU), + PAT(0x00ffff00U), + PAT(0x00ffffffU), + PAT(0xff000000U), + PAT(0xff0000ffU), + PAT(0xff00ff00U), + PAT(0xff00ffffU), + PAT(0xffff0000U), + PAT(0xffff00ffU), + PAT(0xffffff00U), + PAT(0xffffffffU), }; /* force some bits to zero */ diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index c7ce82d064..a8e87c4446 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -237,7 +237,7 @@ bool_t vlapic_match_dest( case APIC_DEST_NOSHORT: if ( dest_mode ) return vlapic_match_logical_addr(target, dest); - return (dest == _VLAPIC_ID(target, 0xffffffff)) || + return (dest == _VLAPIC_ID(target, 0xffffffffU)) || (dest == VLAPIC_ID(target)); case APIC_DEST_SELF: @@ -467,7 +467,7 @@ static bool_t is_multicast_dest(struct vlapic *vlapic, unsigned int short_hand, return short_hand != APIC_DEST_SELF; if ( vlapic_x2apic_mode(vlapic) ) - return dest_mode ? hweight16(dest) > 1 : dest == 0xffffffff; + return dest_mode ? hweight16(dest) > 1 : dest == 0xffffffffU; if ( dest_mode ) return hweight8(dest & @@ -831,7 +831,7 @@ void vlapic_reg_write(struct vcpu *v, unsigned int reg, uint32_t val) break; case APIC_ICR2: - vlapic_set_reg(vlapic, APIC_ICR2, val & 0xff000000); + vlapic_set_reg(vlapic, APIC_ICR2, val & 0xff000000U); break; case APIC_LVTT: /* LVT Timer Reg */ diff --git a/xen/arch/x86/include/asm/hvm/trace.h b/xen/arch/x86/include/asm/hvm/trace.h index 696e42eb94..22eadbdd47 100644 --- a/xen/arch/x86/include/asm/hvm/trace.h +++ b/xen/arch/x86/include/asm/hvm/trace.h @@ -58,7 +58,7 @@ #define DO_TRC_HVM_VLAPIC DEFAULT_HVM_MISC -#define TRC_PAR_LONG(par) ((par)&0xFFFFFFFF),((par)>>32) +#define TRC_PAR_LONG(par) ((uint32_t)(par)), ((par) >> 32) #define TRACE_2_LONG_2D(_e, d1, d2, ...) \ TRACE_4D(_e, d1, d2) @@ -93,7 +93,7 @@ HVMTRACE_ND(evt, 0, 0) #define HVMTRACE_LONG_1D(evt, d1) \ - HVMTRACE_2D(evt ## 64, (d1) & 0xFFFFFFFF, (d1) >> 32) + HVMTRACE_2D(evt ## 64, (uint32_t)(d1), (d1) >> 32) #define HVMTRACE_LONG_2D(evt, d1, d2, ...) \ HVMTRACE_3D(evt ## 64, d1, d2) #define HVMTRACE_LONG_3D(evt, d1, d2, d3, ...) \ diff --git a/xen/arch/x86/include/asm/hvm/vioapic.h b/xen/arch/x86/include/asm/hvm/vioapic.h index 2944ec20dd..68af6dce79 100644 --- a/xen/arch/x86/include/asm/hvm/vioapic.h +++ b/xen/arch/x86/include/asm/hvm/vioapic.h @@ -32,7 +32,7 @@ #define VIOAPIC_EDGE_TRIG 0 #define VIOAPIC_LEVEL_TRIG 1 -#define VIOAPIC_DEFAULT_BASE_ADDRESS 0xfec00000 +#define VIOAPIC_DEFAULT_BASE_ADDRESS 0xfec00000U #define VIOAPIC_MEM_LENGTH 0x100 /* Direct registers. */