From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: linux-kernel@vger.kernel.org,
llvmlinux@lists.linuxfoundation.org,
clang-built-linux@googlegroups.com
Subject: instructions: using clang's static analyzer on arbitrary kernel modules
Date: Fri, 3 Jan 2020 15:19:19 +0100 [thread overview]
Message-ID: <20200103141919.GA1258456@zx2c4.com> (raw)
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
reply other threads:[~2020-01-03 14:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200103141919.GA1258456@zx2c4.com \
--to=jason@zx2c4.com \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvmlinux@lists.linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox