sparse: add -Wpointer-arith flag to toggle sizeof(void) warnings
commit1becdeff8255ee58ca306c7bbfb1d0ba7721e937
authorJoey Pabalinas <joeypabalinas@gmail.com>
Tue, 10 Apr 2018 22:46:24 +0000 (10 12:46 -1000)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 12 Apr 2018 11:45:20 +0000 (12 14:45 +0300)
tree42792d82c0827111370f5d7a865cb6b696c3f37d
parenta0c0ae87aae35cd4aa2593837ce77e5a39e5f2a8
sparse: add -Wpointer-arith flag to toggle sizeof(void) warnings

Recent changes to the min()/max() macros in include/linux/kernel.h
have added a lot of noise when compiling the kernel with Sparse checking
enabled. This mostly is due to the *huge* increase in the number of
sizeof(void) warnings, a larger number of which can safely be ignored.

Add the -Wpointer-arith flag to enable/disable these warnings (along
with the warning when applying sizeof to function types as well as
warning about pointer arithmetic on these types exactly like the
GCC -Wpointer-arith flag) on demand; the warning itself has been disabled
by default to reduce the large influx of noise which was inadvertently
added by commit 3c8ba0d61d04ced9f8 (kernel.h: Retain constant expression
output for max()/min()).

Update the manpage to document the new flag and add a validation case
for sizeof(void).

CC: Kees Cook <keescook@chromium.org>
CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Martin Uecker <Martin.Uecker@med.uni-goettingen.de>
CC: Al Viro <viro@ZenIV.linux.org.uk>
CC: Christopher Li <sparse@chrisli.org>
CC: Joey Pabalinas <joeypabalinas@gmail.com>
CC: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
 5 files changed, 64 insertions(+), 2 deletions(-)

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
evaluate.c
lib.c
lib.h
sparse.1
validation/sizeof-void.c [new file with mode: 0644]