Sparse improvements & regressions for Linux v5.7-rc1 -> v5.8-rc1

From: Luc Van Oostenryck
Date: Tue Jul 07 2020 - 20:06:57 EST


I've finally written a silly script to easily compare my tests
of Sparse on the kernel. So, it's now easy to share those results.

It's a comparison of Sparse's unique warnings between v5.7-rc1 &
v5.8-rc1 on x86-64 (defconfig + allyesconfig). The results are
quite similar on other architectures.

Note that the differences can be caused by changes in the kernel
code or in Sparse code.

Have fun.

- 20114 19249 Total

+ 95 161 Initializer entry defined twice
- 152 98 Using plain integer as NULL pointer
394 394 advancing past deep designator
4 4 arithmetics on pointers to functions
+ 15 16 bad assignment to restricted type
4 4 cast between address spaces (<asn:3> -> <asn:4>)
+ 0 38 cast from non-scalar
- 288 276 cast from restricted type
- 43 41 cast removes address space '<asn:1>' of expression
142 142 cast removes address space '<asn:2>' of expression
1 1 cast removes address space '<asn:3>' of expression
+ 10 15 cast removes address space '<asn:4>' of expression
+ 13 51 cast to non-scalar
- 4796 4512 cast to restricted type
+ 595 609 cast truncates bits from constant value
+ 335 349 context imbalance - different lock contexts for basic block
- 463 453 context imbalance - unexpected unlock
- 198 189 context imbalance - wrong count at exit
+ 117 118 dereference of noderef expression
+ 10 13 dubious: !x & y
+ 0 1 dubious: !x | !y
6 6 dubious: !x | y
+ 56 57 dubious: x & !y
21 21 dubious: x | !y
+ 17 21 function with external linkage has definition
2 2 implicit cast from nocast type
+ 497 500 incompatible types in comparison expression (different address spaces)
3 3 incompatible types in comparison expression (different base types)
1 1 incompatible types in comparison expression (different type sizes)
+ 5 6 incompatible types in conditional expression (different base types)
+ 1216 1225 incorrect type in argument (different address spaces)
- 528 515 incorrect type in argument (different base types)
+ 0 5 incorrect type in argument (different modifiers)
- 11 10 incorrect type in argument (different type sizes)
+ 0 1 incorrect type in argument (incompatible argument (different address spaces))
1 1 incorrect type in argument (incompatible argument (different base types))
+ 369 388 incorrect type in assignment (different address spaces)
- 5607 4945 incorrect type in assignment (different base types)
1 1 incorrect type in assignment (different modifiers)
+ 139 141 incorrect type in initializer (different address spaces)
- 141 132 incorrect type in initializer (different base types)
+ 4 7 incorrect type in initializer (incompatible argument (different address spaces))
- 27 26 incorrect type in return expression (different address spaces)
- 30 26 incorrect type in return expression (different base types)
- 516 451 invalid assignement
37 37 invalid bitfield specifier for type restricted type.
13 13 invalid initializer
1 1 marked inline, but without a definition
1 1 memcpy with byte count of ...
5 5 memset with byte count of ...
- 10 0 missing braces around initializer
7 7 mixed bitwiseness
10 10 mixing different enum types:
1 1 multiple address spaces given
- 2 1 no newline at end of file
1 1 non-scalar type in conditional:
- 1 0 preprocessor token offsetof redefined
+ 948 959 restricted type degrades to integer
+ 42 43 return expression in void function
3 3 shift count is (-1)
5 5 shift too big for type
12 12 static assertion failed
5 5 subtraction of different types can't work (different address spaces)
+ 23 24 subtraction of functions? Share your drugs
1 1 switch with no cases
+ 0 5 symbol redeclared with different type (incompatible argument (different address spaces))
+ 2109 2135 symbol was not declared. Should it be static?
1 1 too long token expansion
3 3 trying to concatenate long character string (8191 bytes max)