mbox series

[V2,00/15] cleanup cppcheck signed shifting errors

Message ID 20190624135105.15579-1-tranmanphong@gmail.com (mailing list archive)
Headers show
Series cleanup cppcheck signed shifting errors | expand

Message

Phong Tran June 24, 2019, 1:50 p.m. UTC
There are errors with cppcheck 

"Shifting signed 32-bit value by 31 bits is undefined behaviour errors"

This is just a mirror changing. 

V2: Using BIT() macro instead of (1UL << nr) 

Phong Tran (15):
  arm: perf: cleanup cppcheck shifting error
  ARM: davinci: cleanup cppcheck shifting errors
  ARM: ep93xx: cleanup cppcheck shifting errors
  ARM: exynos: cleanup cppcheck shifting error
  ARM: footbridge: cleanup cppcheck shifting error
  ARM: imx: cleanup cppcheck shifting errors
  ARM: ks8695: cleanup cppcheck shifting error
  ARM: mmp: cleanup cppcheck shifting errors
  ARM: omap2: cleanup cppcheck shifting error
  ARM: orion5x: cleanup cppcheck shifting errors
  ARM: pxa: cleanup cppcheck shifting errors
  ARM: vexpress: cleanup cppcheck shifting error
  ARM: mm: cleanup cppcheck shifting errors
  ARM: bpf: cleanup cppcheck shifting error
  ARM: vfp: cleanup cppcheck shifting errors

 arch/arm/kernel/perf_event_v7.c    |   6 +-
 arch/arm/mach-davinci/ddr2.h       |   6 +-
 arch/arm/mach-ep93xx/soc.h         | 132 ++++++++++++++++++-------------------
 arch/arm/mach-exynos/suspend.c     |   2 +-
 arch/arm/mach-footbridge/dc21285.c |   2 +-
 arch/arm/mach-imx/iomux-mx3.h      |  64 +++++++++---------
 arch/arm/mach-ks8695/regs-pci.h    |   4 +-
 arch/arm/mach-mmp/pm-mmp2.h        |  40 +++++------
 arch/arm/mach-mmp/pm-pxa910.h      |  76 ++++++++++-----------
 arch/arm/mach-omap2/powerdomain.c  |   2 +-
 arch/arm/mach-orion5x/pci.c        |   8 +--
 arch/arm/mach-pxa/irq.c            |   4 +-
 arch/arm/mach-vexpress/spc.c       |  12 ++--
 arch/arm/mm/fault.h                |   6 +-
 arch/arm/net/bpf_jit_32.c          |   2 +-
 arch/arm/vfp/vfpinstr.h            |   8 +--
 16 files changed, 187 insertions(+), 187 deletions(-)

Comments

Russell King (Oracle) June 24, 2019, 2:02 p.m. UTC | #1
On Mon, Jun 24, 2019 at 08:50:50PM +0700, Phong Tran wrote:
> There are errors with cppcheck 
> 
> "Shifting signed 32-bit value by 31 bits is undefined behaviour errors"
> 
> This is just a mirror changing. 

"mirror" ?

Apart from that and the extra unnecessary parens (which ought to be
cleaned up) this looks fine to me.

When there's too many parens next to each other, it makes reading
the expression more difficult - and that is definitely bad, so please
avoid unecessary parens where possible.

Thanks.

> 
> V2: Using BIT() macro instead of (1UL << nr) 
> 
> Phong Tran (15):
>   arm: perf: cleanup cppcheck shifting error
>   ARM: davinci: cleanup cppcheck shifting errors
>   ARM: ep93xx: cleanup cppcheck shifting errors
>   ARM: exynos: cleanup cppcheck shifting error
>   ARM: footbridge: cleanup cppcheck shifting error
>   ARM: imx: cleanup cppcheck shifting errors
>   ARM: ks8695: cleanup cppcheck shifting error
>   ARM: mmp: cleanup cppcheck shifting errors
>   ARM: omap2: cleanup cppcheck shifting error
>   ARM: orion5x: cleanup cppcheck shifting errors
>   ARM: pxa: cleanup cppcheck shifting errors
>   ARM: vexpress: cleanup cppcheck shifting error
>   ARM: mm: cleanup cppcheck shifting errors
>   ARM: bpf: cleanup cppcheck shifting error
>   ARM: vfp: cleanup cppcheck shifting errors
> 
>  arch/arm/kernel/perf_event_v7.c    |   6 +-
>  arch/arm/mach-davinci/ddr2.h       |   6 +-
>  arch/arm/mach-ep93xx/soc.h         | 132 ++++++++++++++++++-------------------
>  arch/arm/mach-exynos/suspend.c     |   2 +-
>  arch/arm/mach-footbridge/dc21285.c |   2 +-
>  arch/arm/mach-imx/iomux-mx3.h      |  64 +++++++++---------
>  arch/arm/mach-ks8695/regs-pci.h    |   4 +-
>  arch/arm/mach-mmp/pm-mmp2.h        |  40 +++++------
>  arch/arm/mach-mmp/pm-pxa910.h      |  76 ++++++++++-----------
>  arch/arm/mach-omap2/powerdomain.c  |   2 +-
>  arch/arm/mach-orion5x/pci.c        |   8 +--
>  arch/arm/mach-pxa/irq.c            |   4 +-
>  arch/arm/mach-vexpress/spc.c       |  12 ++--
>  arch/arm/mm/fault.h                |   6 +-
>  arch/arm/net/bpf_jit_32.c          |   2 +-
>  arch/arm/vfp/vfpinstr.h            |   8 +--
>  16 files changed, 187 insertions(+), 187 deletions(-)
> 
> -- 
> 2.11.0
> 
>
Peter Zijlstra June 24, 2019, 3:27 p.m. UTC | #2
On Mon, Jun 24, 2019 at 08:50:50PM +0700, Phong Tran wrote:
> There are errors with cppcheck 
> 
> "Shifting signed 32-bit value by 31 bits is undefined behaviour errors"

As I've already told you; your checker is bad. That is not in face
undefined behaviour in the kernel.

That's not to say you shouldn't clean up the code, but don't give broken
checkout output as a reason.
Peter Zijlstra June 24, 2019, 3:28 p.m. UTC | #3
On Mon, Jun 24, 2019 at 05:27:43PM +0200, Peter Zijlstra wrote:
> On Mon, Jun 24, 2019 at 08:50:50PM +0700, Phong Tran wrote:
> > There are errors with cppcheck 
> > 
> > "Shifting signed 32-bit value by 31 bits is undefined behaviour errors"
> 
> As I've already told you; your checker is bad. That is not in face

Bah, fact, typing hard.

> undefined behaviour in the kernel.
> 
> That's not to say you shouldn't clean up the code, but don't give broken
> checkout output as a reason.