[PATCH] D59963: [clang-tidy] Add a module for the Linux kernel.
Tom Roeder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 20 11:55:18 PDT 2019
tmroeder marked an inline comment as done.
tmroeder added inline comments.
================
Comment at: clang-tools-extra/test/clang-tidy/linuxkernel-must-check-errs.c:6
+// Prototypes of the error functions.
+void * __must_check ERR_PTR(long error);
+long __must_check PTR_ERR(const void *ptr);
----------------
nickdesaulniers wrote:
> Let's come up with another check; `__must_check` has a bug upstream in the kernel sources (I looked into this maybe a month ago). The kernel disables a warning group that this would be under, if I re-enable the lone warning, then this works properly at compile time. (I forget the warning, and should have filed a bug). Point being, fixing this upstream in kernel sources is preferable to me to a clang tidy check, but it's a good start.
Good point. How about the related smatch checks in https://repo.or.cz/smatch.git/blob_plain/HEAD:/check_err_ptr_deref.c
It looks for cases where possible ERR_PTR values are dereferenced (wrong because it's not a pointer), and passing non-negative values to ERR_PTR.
What do you think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59963/new/
https://reviews.llvm.org/D59963
More information about the cfe-commits
mailing list