# git rev-parse -q --verify 6ad7cbc01527223f3f92baac9b122f15651cf76b^{commit} # git fetch -q -n -f git://gitlab.ozlabs.ibm.com/mirror/linux-kbuild.git for-next # git rev-parse -q --verify 6ad7cbc01527223f3f92baac9b122f15651cf76b^{commit} 6ad7cbc01527223f3f92baac9b122f15651cf76b # git checkout -q -f -B kisskb 6ad7cbc01527223f3f92baac9b122f15651cf76b # git clean -qxdf # < git log -1 # commit 6ad7cbc01527223f3f92baac9b122f15651cf76b # Author: Nathan Huckleberry # Date: Sat Aug 22 23:56:18 2020 +0900 # # Makefile: Add clang-tidy and static analyzer support to makefile # # This patch adds clang-tidy and the clang static-analyzer as make # targets. The goal of this patch is to make static analysis tools # usable and extendable by any developer or researcher who is familiar # with basic c++. # # The current static analysis tools require intimate knowledge of the # internal workings of the static analysis. Clang-tidy and the clang # static analyzers expose an easy to use api and allow users unfamiliar # with clang to write new checks with relative ease. # # ===Clang-tidy=== # # Clang-tidy is an easily extendable 'linter' that runs on the AST. # Clang-tidy checks are easy to write and understand. A check consists of # two parts, a matcher and a checker. The matcher is created using a # domain specific language that acts on the AST # (https://clang.llvm.org/docs/LibASTMatchersReference.html). When AST # nodes are found by the matcher a callback is made to the checker. The # checker can then execute additional checks and issue warnings. # # Here is an example clang-tidy check to report functions that have calls # to local_irq_disable without calls to local_irq_enable and vice-versa. # Functions flagged with __attribute((annotation("ignore_irq_balancing"))) # are ignored for analysis. (https://reviews.llvm.org/D65828) # # ===Clang static analyzer=== # # The clang static analyzer is a more powerful static analysis tool that # uses symbolic execution to find bugs. Currently there is a check that # looks for potential security bugs from invalid uses of kmalloc and # kfree. There are several more general purpose checks that are useful for # the kernel. # # The clang static analyzer is well documented and designed to be # extensible. # (https://clang-analyzer.llvm.org/checker_dev_manual.html) # (https://github.com/haoNoQ/clang-analyzer-guide/releases/download/v0.1/clang-analyzer-guide-v0.1.pdf) # # The main draw of the clang tools is how accessible they are. The clang # documentation is very nice and these tools are built specifically to be # easily extendable by any developer. They provide an accessible method of # bug-finding and research to people who are not overly familiar with the # kernel codebase. # # Signed-off-by: Nathan Huckleberry # Reviewed-by: Nick Desaulniers # Tested-by: Nick Desaulniers # Tested-by: Lukas Bulwahn # Signed-off-by: Masahiro Yamada # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux-ld --version # < git log --format=%s --max-count=1 6ad7cbc01527223f3f92baac9b122f15651cf76b # < make -s -j 48 ARCH=m68k O=/kisskb/build/kbuild_m68k-defconfig_m68k-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux- defconfig # < make -s -j 48 ARCH=m68k O=/kisskb/build/kbuild_m68k-defconfig_m68k-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux- help # make -s -j 48 ARCH=m68k O=/kisskb/build/kbuild_m68k-defconfig_m68k-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux- olddefconfig # make -s -j 48 ARCH=m68k O=/kisskb/build/kbuild_m68k-defconfig_m68k-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/m68k-linux/bin/m68k-linux- /kisskb/src/arch/m68k/mvme147/config.c: In function 'mvme147_hwclk': /kisskb/src/arch/m68k/mvme147/config.c:174:2: warning: #warning check me! [-Wcpp] #warning check me! ^~~~~~~ /kisskb/src/arch/m68k/mvme16x/config.c: In function 'mvme16x_hwclk': /kisskb/src/arch/m68k/mvme16x/config.c:439:2: warning: #warning check me! [-Wcpp] #warning check me! ^~~~~~~ In file included from /kisskb/src/drivers/net/ethernet/8390/xsurf100.c:48: /kisskb/src/drivers/net/ethernet/8390/lib8390.c:988:27: warning: '____alloc_ei_netdev' defined but not used [-Wunused-function] static struct net_device *____alloc_ei_netdev(int size) ^~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:950:13: warning: '__ei_set_multicast_list' defined but not used [-Wunused-function] static void __ei_set_multicast_list(struct net_device *dev) ^~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:850:33: warning: '__ei_get_stats' defined but not used [-Wunused-function] static struct net_device_stats *__ei_get_stats(struct net_device *dev) ^~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:509:13: warning: '__ei_poll' defined but not used [-Wunused-function] static void __ei_poll(struct net_device *dev) ^~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:300:20: warning: '__ei_start_xmit' defined but not used [-Wunused-function] static netdev_tx_t __ei_start_xmit(struct sk_buff *skb, ^~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:254:13: warning: '__ei_tx_timeout' defined but not used [-Wunused-function] static void __ei_tx_timeout(struct net_device *dev, unsigned int txqueue) ^~~~~~~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:230:12: warning: '__ei_close' defined but not used [-Wunused-function] static int __ei_close(struct net_device *dev) ^~~~~~~~~~ /kisskb/src/drivers/net/ethernet/8390/lib8390.c:201:12: warning: '__ei_open' defined but not used [-Wunused-function] static int __ei_open(struct net_device *dev) ^~~~~~~~~ In file included from /kisskb/src/arch/m68k/include/asm/atomic.h:7, from /kisskb/src/include/linux/atomic.h:7, from /kisskb/src/include/linux/cpumask.h:13, from /kisskb/src/include/linux/smp.h:13, from /kisskb/src/include/linux/lockdep.h:14, from /kisskb/src/include/linux/spinlock.h:59, from /kisskb/src/include/linux/wait.h:9, from /kisskb/src/include/linux/wait_bit.h:8, from /kisskb/src/include/linux/fs.h:6, from /kisskb/src/fs/ocfs2/file.c:13: /kisskb/src/fs/ocfs2/file.c: In function 'ocfs2_file_write_iter': /kisskb/src/arch/m68k/include/asm/cmpxchg.h:79:22: warning: value computed is not used [-Wunused-value] #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/fs/ocfs2/file.c:2419:3: note: in expansion of macro 'xchg' xchg(&iocb->ki_complete, saved_ki_complete); ^~~~ Completed OK # rm -rf /kisskb/build/kbuild_m68k-defconfig_m68k-gcc8 # Build took: 0:02:19.958254