db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / validation / byte-count-max.c
blob0555a505369ee43089dba683784fff30d7994ec2
1 typedef unsigned long int size_t;
2 typedef unsigned long ulong;
4 extern void *memset(void *s, int c, size_t n);
5 extern void *memcpy(void *dest, void *src, size_t n);
6 extern ulong copy_to_user(void *to, const void *from, ulong count);
7 extern ulong copy_from_user(void *to, const void *from, ulong count);
9 static void func (char *s)
11 char d[250000];
13 memset(d, 0, 250000);
14 memcpy(d, s, 250000);
15 copy_to_user(s, d, 250000);
16 copy_from_user(d, s, 250000);
20 * check-name: byte-count-max
22 * check-error-start
23 byte-count-max.c:13:15: warning: memset with byte count of 250000
24 byte-count-max.c:14:15: warning: memcpy with byte count of 250000
25 byte-count-max.c:15:21: warning: copy_to_user with byte count of 250000
26 byte-count-max.c:16:23: warning: copy_from_user with byte count of 250000
27 * check-error-end