Sounds like a good start.

On Thu, Jun 20, 2019 at 11:55 AM Tom Roeder via Phabricator
<revi...@reviews.llvm.org> wrote:
>
> 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
>
>
>


-- 
Thanks,
~Nick Desaulniers
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to