conditions: use set_extra_expr_mod() to change extra states
[smatch.git] / validation / sm_array_overflow5.c
blobc81d70a3c59382518b4334d6edb5e5a26201d7db
1 #include <stdio.h>
2 #include <string.h>
3 #include "check_debug.h"
5 void *kmalloc(int size, int mask);
7 struct foo {
8 int x, y, z;
9 int buf[0];
12 int main(void)
14 struct foo *p;
16 p = kmalloc(sizeof(*p) + 100, 0);
17 if (!p)
18 return -12;
19 __smatch_buf_size(p->buf);
21 return 0;
26 * check-name: smatch: overflow check #5
27 * check-command: smatch -p=kernel -I.. sm_array_overflow5.c
29 * check-output-start
30 sm_array_overflow5.c:19 main() buf size: 'p->buf' 25 elements, 100 bytes
31 * check-output-end