mbox series

[RFC,00/18] cppcheck rule 20.7 fixes

Message ID 20221220085100.22848-1-luca.fancellu@arm.com (mailing list archive)
Headers show
Series cppcheck rule 20.7 fixes | expand

Message

Luca Fancellu Dec. 20, 2022, 8:50 a.m. UTC
In this serie there are some fixes for the rule 20.7, mainly violation found by
cppcheck, most of them are false positive but some of them can be fixed.

The analysed build is arm64, to reproduce the reports here the command:

./xen/scripts/xen-analysis.py --cppcheck-misra --run-cppcheck -- CROSS_COMPILE="aarch64-linux-gnu-" XEN_TARGET_ARCH="arm64" O=/path/to/artifacts_folder

Luca Fancellu (18):
  arm: cppcheck: misra rule 20.7 deviations for alternative.h
  arm: cppcheck: misra rule 20.7 deviation on processor.h
  arm: cppcheck: misra rule 20.7 deviation on asm_defns.h
  arm: cppcheck: misra rule 20.7 deviation on config.h
  arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
  public: cppcheck: misra rule 20.7 on public/arch-arm.h
  xen: cppcheck: misra rule 20.7 deviation on compiler.h
  xen: cppcheck: misra rule 20.7 deviation on init.h
  xen: cppcheck: misra rule 20.7 deviation on kconfig.h
  xen: cppcheck: misra rule 20.7 deviation on types.h
  xen: cppcheck: misra rule 20.7 deviation on xmalloc.h
  arm: cppcheck: misra rule 20.7 deviation on asm/arm64/sysregs.h
  public/x86: cppcheck: misra rule 20.7 deviation on hvm/save.h
  public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_32.h
  public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_64.h
  public/x86: cppcheck: misra rule 20.7 deviation on arch-x86/xen.h
  public: misra rule 20.7 deviation on errno.h
  public: misra rule 20.7 deviation on memory.h

 docs/misra/false-positive-cppcheck.json    | 21 +++++++++++++++++++++
 xen/arch/arm/include/asm/alternative.h     |  2 ++
 xen/arch/arm/include/asm/arm64/processor.h |  2 +-
 xen/arch/arm/include/asm/arm64/sysregs.h   |  2 +-
 xen/arch/arm/include/asm/asm_defns.h       |  2 ++
 xen/arch/arm/include/asm/config.h          |  4 ++++
 xen/arch/arm/include/asm/string.h          |  2 +-
 xen/include/public/arch-arm.h              |  4 +++-
 xen/include/public/arch-x86/hvm/save.h     |  1 +
 xen/include/public/arch-x86/xen-x86_32.h   |  5 ++++-
 xen/include/public/arch-x86/xen-x86_64.h   |  3 +++
 xen/include/public/arch-x86/xen.h          |  3 ++-
 xen/include/public/errno.h                 |  2 +-
 xen/include/public/memory.h                |  2 +-
 xen/include/xen/compiler.h                 |  1 +
 xen/include/xen/init.h                     |  7 ++++---
 xen/include/xen/kconfig.h                  |  1 +
 xen/include/xen/types.h                    |  1 +
 xen/include/xen/xmalloc.h                  |  6 ++++++
 19 files changed, 60 insertions(+), 11 deletions(-)

Comments

Jan Beulich Dec. 20, 2022, 9:55 a.m. UTC | #1
On 20.12.2022 09:50, Luca Fancellu wrote:
> In this serie there are some fixes for the rule 20.7, mainly violation found by
> cppcheck, most of them are false positive but some of them can be fixed.
> 
> The analysed build is arm64, to reproduce the reports here the command:
> 
> ./xen/scripts/xen-analysis.py --cppcheck-misra --run-cppcheck -- CROSS_COMPILE="aarch64-linux-gnu-" XEN_TARGET_ARCH="arm64" O=/path/to/artifacts_folder
> 
> Luca Fancellu (18):
>   arm: cppcheck: misra rule 20.7 deviations for alternative.h
>   arm: cppcheck: misra rule 20.7 deviation on processor.h
>   arm: cppcheck: misra rule 20.7 deviation on asm_defns.h
>   arm: cppcheck: misra rule 20.7 deviation on config.h
>   arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
>   public: cppcheck: misra rule 20.7 on public/arch-arm.h
>   xen: cppcheck: misra rule 20.7 deviation on compiler.h
>   xen: cppcheck: misra rule 20.7 deviation on init.h
>   xen: cppcheck: misra rule 20.7 deviation on kconfig.h
>   xen: cppcheck: misra rule 20.7 deviation on types.h
>   xen: cppcheck: misra rule 20.7 deviation on xmalloc.h
>   arm: cppcheck: misra rule 20.7 deviation on asm/arm64/sysregs.h
>   public/x86: cppcheck: misra rule 20.7 deviation on hvm/save.h
>   public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_32.h
>   public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_64.h
>   public/x86: cppcheck: misra rule 20.7 deviation on arch-x86/xen.h
>   public: misra rule 20.7 deviation on errno.h
>   public: misra rule 20.7 deviation on memory.h

Like Julien I object to the massive addition of false positive markers
just because of very basic shortcomings in cppcheck. I find this
particularly bad in public headers - imo no such annotations should
appear there at all. I would suggest that you split off the actual
code changes, which are likely going to be less controversial.

Jan
Luca Fancellu Dec. 21, 2022, 8:49 a.m. UTC | #2
> On 20 Dec 2022, at 09:55, Jan Beulich <jbeulich@suse.com> wrote:
> 
> On 20.12.2022 09:50, Luca Fancellu wrote:
>> In this serie there are some fixes for the rule 20.7, mainly violation found by
>> cppcheck, most of them are false positive but some of them can be fixed.
>> 
>> The analysed build is arm64, to reproduce the reports here the command:
>> 
>> ./xen/scripts/xen-analysis.py --cppcheck-misra --run-cppcheck -- CROSS_COMPILE="aarch64-linux-gnu-" XEN_TARGET_ARCH="arm64" O=/path/to/artifacts_folder
>> 
>> Luca Fancellu (18):
>>  arm: cppcheck: misra rule 20.7 deviations for alternative.h
>>  arm: cppcheck: misra rule 20.7 deviation on processor.h
>>  arm: cppcheck: misra rule 20.7 deviation on asm_defns.h
>>  arm: cppcheck: misra rule 20.7 deviation on config.h
>>  arm: cppcheck: fix misra rule 20.7 on arm/include/asm/string.h
>>  public: cppcheck: misra rule 20.7 on public/arch-arm.h
>>  xen: cppcheck: misra rule 20.7 deviation on compiler.h
>>  xen: cppcheck: misra rule 20.7 deviation on init.h
>>  xen: cppcheck: misra rule 20.7 deviation on kconfig.h
>>  xen: cppcheck: misra rule 20.7 deviation on types.h
>>  xen: cppcheck: misra rule 20.7 deviation on xmalloc.h
>>  arm: cppcheck: misra rule 20.7 deviation on asm/arm64/sysregs.h
>>  public/x86: cppcheck: misra rule 20.7 deviation on hvm/save.h
>>  public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_32.h
>>  public/x86: cppcheck: misra rule 20.7 deviation on xen-x86_64.h
>>  public/x86: cppcheck: misra rule 20.7 deviation on arch-x86/xen.h
>>  public: misra rule 20.7 deviation on errno.h
>>  public: misra rule 20.7 deviation on memory.h
> 
> Like Julien I object to the massive addition of false positive markers
> just because of very basic shortcomings in cppcheck. I find this
> particularly bad in public headers - imo no such annotations should
> appear there at all. I would suggest that you split off the actual
> code changes, which are likely going to be less controversial.

Yes I will send the patches with your review and drop the others with
False-positive or fixes that are not agreed.


> 
> Jan