xref: /illumos-gate/usr/src/tools/smatch/src/validation/sm_err_ptr.c (revision 933ae53f0bf0708d7bf2756d3f21936a0d5fad82)
1 #include <stdio.h>
2 
3 int *add_inode();
4 int IS_ERR(void *);
5 
6 int main(void)
7 {
8 	int *p;
9 
10 	p = add_inode();
11 	if (!IS_ERR(p)) {
12 		*p = 1;
13 	}
14 	*p = 1;
15 
16 	return 0;
17 }
18 /*
19  * check-name: dereferencing ERR_PTR bugs
20  * check-command: smatch -p=kernel sm_err_ptr.c
21  *
22  * check-output-start
23 sm_err_ptr.c:14 main() error: 'p' dereferencing possible ERR_PTR()
24  * check-output-end
25  */
26