Sparse improvements & regressions for Linux v5.9-rc1 -> v5.10-rc1

From: Luc Van Oostenryck
Date: Tue Oct 27 2020 - 17:03:52 EST


Hi,

Here is a comparison of Sparse's unique warnings between v5.9-rc1 &
v5.10-rc1 on x86-64 (defconfig + allyesconfig).

This time, there is a VERY significant decrease in the number of
warnings, almost 20% less. On ppc64, the difference is 31%. This big
difference is mainly but not only caused by "cast to restricted type"
warnings or related, like "different base types".

Some of these differences come from changes in Sparse, but most come
from changes in the kernel itself.

The raw logs as well as the result of the processing giving the
'unique warnings' are available at:
git://github.com/lucvoo/sparse-logs.git


- 18621 14983 Total
+ 191 210 Initializer entry defined twice
- 105 92 Using plain integer as NULL pointer
- 394 0 advancing past deep designator
4 4 arithmetics on pointers to functions
+ 0 88 array of flexible structures
- 12 10 bad assignment to restricted type
4 4 cast between address spaces (__percpu -> __rcu)
- 261 257 cast from restricted type
- 473 468 cast removes address space '__iomem' of expression
1 1 cast removes address space '__percpu' of expression
15 15 cast removes address space '__rcu' of expression
- 43 20 cast removes address space '__user' of expression
- 13 0 cast to non-scalar
- 4550 2862 cast to restricted type
- 609 548 cast truncates bits from constant value
+ 332 359 context imbalance - different lock contexts for basic block
+ 467 472 context imbalance - unexpected unlock
+ 189 191 context imbalance - wrong count at exit
- 109 106 dereference of noderef expression
+ 0 1 division by zero
+ 0 1 dubious one-bit signed bitfield
16 16 dubious: !x & y
1 1 dubious: !x | !y
6 6 dubious: !x | y
56 56 dubious: x & !y
- 20 19 dubious: x | !y
- 1 0 duplicate [noderef]
- 21 18 function with external linkage has definition
2 2 implicit cast from nocast type
- 490 458 incompatible types in comparison expression (different address spaces)
+ 3 4 incompatible types in comparison expression (different base types)
- 1 0 incompatible types in comparison expression (different type sizes)
7 7 incompatible types in conditional expression (different base types)
- 1087 1031 incorrect type in argument (different address spaces)
- 494 477 incorrect type in argument (different base types)
- 1 0 incorrect type in argument (incompatible argument (different address spaces))
- 382 336 incorrect type in assignment (different address spaces)
- 4762 3513 incorrect type in assignment (different base types)
1 1 incorrect type in assignment (different modifiers)
+ 120 130 incorrect type in initializer (different address spaces)
- 131 124 incorrect type in initializer (different base types)
- 7 4 incorrect type in initializer (incompatible argument (different address spaces))
- 25 24 incorrect type in return expression (different address spaces)
- 30 25 incorrect type in return expression (different base types)
- 285 282 invalid assignment
37 37 invalid bitfield specifier for type restricted type.
7 7 invalid initializer
+ 1 2 marked inline, but without a definition
- 1 0 memcpy with byte count of ...
- 5 4 memset with byte count of ...
7 7 mixed bitwiseness
8 8 mixing different enum types:
- 2 1 multiple address spaces given
12 12 multiple definitions for ...
+ 0 2 no generic selection for ...
- 918 902 restricted type degrades to integer
+ 0 1 statement expected after label
+ 12 16 static assertion failed
5 5 subtraction of different types can't work (different address spaces)
23 23 subtraction of functions? Share your drugs
1 1 switch with no cases
+ 0 1 symbol redeclared with different type (different address spaces)
- 5 2 symbol redeclared with different type (incompatible argument (different address spaces))
- 1852 1705 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)