db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / validation / sm_err_ptr.c
blob980460eed158e5d2be2e68df158c30f679b0c9cc
1 #include <stdio.h>
3 int *add_inode();
4 #define IS_ERR_VALUE(x) ((x) >= (unsigned long)-4095)
5 static int IS_ERR(const void *ptr)
7 return IS_ERR_VALUE((unsigned long)ptr);
10 int main(void)
12 int *p;
14 p = add_inode();
15 if (!IS_ERR(p)) {
16 *p = 1;
18 *p = 1;
20 return 0;
23 * check-name: dereferencing ERR_PTR bugs
24 * check-command: smatch -p=kernel sm_err_ptr.c
26 * check-output-start
27 sm_err_ptr.c:18 main() error: 'p' dereferencing possible ERR_PTR()
28 * check-output-end