1 #include "check_debug.h"
2 
3 int frob(void);
4 #define get_user(x, y) ({ int __val_gu = frob(); x = __val_gu; 0; })
5 
func(void)6 void func(void)
7 {
8 	int *user_ptr;
9 	int foo, bar;
10 	unsigned int x;
11 
12 	get_user(foo, user_ptr);
13 	bar = foo + 1;
14 
15 	get_user(bar, user_ptr);
16 	if (bar > foo)
17 		bar = foo;
18 	foo = bar * 8;
19 
20 	get_user(x, user_ptr);
21 	if (x > foo)
22 		x = foo;
23 	foo = x * 8;
24 
25 	get_user(x, user_ptr);
26 	foo = x * 8;
27 }
28 /*
29  * check-name: smatch get_user() #1
30  * check-command: smatch -p=kernel -I.. sm_get_user1.c
31  *
32  * check-output-start
33 sm_get_user1.c:13 func() warn: check for integer over/underflow 'foo'
34 sm_get_user1.c:18 func() warn: check for integer underflow 'bar'
35 sm_get_user1.c:26 func() warn: check for integer overflow 'x'
36  * check-output-end
37  */
38