[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200103141919.GA1258456@zx2c4.com>
Date: Fri, 3 Jan 2020 15:19:19 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: linux-kernel@...r.kernel.org, llvmlinux@...ts.linuxfoundation.org,
clang-built-linux@...glegroups.com
Subject: instructions: using clang's static analyzer on arbitrary kernel
modules
Hi,
I figure I should document this somewhere. Here's what I've been using
to run both clang's scan-build and sparse at the same time on the
wireguard kernel module:
rm -rf /tmp/check-wireguard-linux
make CC=clang O=/tmp/check-wireguard-linux defconfig -j$(nproc)
printf 'CONFIG_WIREGUARD=m\nCONFIG_WIREGUARD_DEBUG=y\n' >> /tmp/check-wireguard-linux/.config
make CC=clang O=/tmp/check-wireguard-linux prepare -j$(nproc)
scan-build --use-cc=clang -maxloop 100 --view --keep-going make CC=clang O=/tmp/check-wireguard-linux drivers/net/wireguard/wireguard.ko -j$(nproc) C=2 CF="-D__CHECK_ENDIAN__"
It seems to generally work well at catching super stupid mistakes.
Regards,
Jason
Powered by blists - more mailing lists