side_effects: the iterate_all_kinds() macro has side effects deliberately
[smatch.git] / validation / sm_err_ptr.c
blobd89f5d86d110c1c6c967cd521eaa275c248e867c
1 #include <stdio.h>
3 int *add_inode();
4 int IS_ERR(void *);
6 int main(void)
8 int *p;
10 p = add_inode();
11 if (!IS_ERR(p)) {
12 *p = 1;
14 *p = 1;
16 return 0;
19 * check-name: dereferencing ERR_PTR bugs
20 * check-command: smatch -p=kernel sm_err_ptr.c
22 * check-output-start
23 sm_err_ptr.c:14 main() error: 'p' dereferencing possible ERR_PTR()
24 * check-output-end