sval: update check_snprintf.c
[smatch.git] / validation / sm_get_user1.c
blob989e8957252507fd9aa03304ceb4ee142625a3df
1 #include "check_debug.h"
3 int frob(void);
4 #define get_user(x, y) ({ int __val_gu = frob(); x = __val_gu; 0; })
6 void func(void)
8 int *user_ptr;
9 int foo, bar;
10 unsigned int x;
12 get_user(foo, user_ptr);
13 bar = foo + 1;
15 get_user(bar, user_ptr);
16 if (bar > foo)
17 bar = foo;
18 foo = bar * 8;
20 get_user(x, user_ptr);
21 if (x > foo)
22 x = foo;
23 foo = x * 8;
25 get_user(x, user_ptr);
26 foo = x * 8;
29 * check-name: smatch get_user() #1
30 * check-command: smatch -p=kernel -I.. sm_get_user1.c
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