[RFC PATCH 00/18] cppcheck rule 20.7 fixes

Luca Fancellu posted 18 patches 1 year, 4 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20221220085100.22848-1-luca.fancellu@arm.com
There is a newer version of this series
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(-)
[RFC PATCH 00/18] cppcheck rule 20.7 fixes
Posted by Luca Fancellu 1 year, 4 months ago
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(-)

-- 
2.17.1
Re: [RFC PATCH 00/18] cppcheck rule 20.7 fixes
Posted by Jan Beulich 1 year, 4 months ago
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
Re: [RFC PATCH 00/18] cppcheck rule 20.7 fixes
Posted by Luca Fancellu 1 year, 4 months ago

> 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