Line data Source code
1 : /*
2 : * Copyright (c) 2014-2016 ISPRAS (http://www.ispras.ru)
3 : * Institute for System Programming of the Russian Academy of Sciences
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * ee the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : #ifndef __VERIFIER_MEMORY_H
19 : #define __VERIFIER_MEMORY_H
20 :
21 : #include <linux/types.h>
22 :
23 : /* Pointers greater then this number correspond to errors. We can't use
24 : * original value defined in linux/err.h (~(unsigned long)-4095) since it is
25 : * too hard for verifiers.
26 : */
27 : #define LDV_PTR_MAX ((unsigned int)-1)
28 :
29 : extern void *ldv_malloc(size_t size);
30 : extern void *ldv_calloc(size_t nmemb, size_t size);
31 : extern void *ldv_zalloc(size_t size);
32 : extern void ldv_free(void *s);
33 :
34 : void *ldv_xmalloc(size_t size);
35 : void *ldv_xzalloc(size_t size);
36 :
37 : extern void *external_allocated_data(void);
38 :
39 : extern void *ldv_malloc_unknown_size(void);
40 : extern void *ldv_calloc_unknown_size(void);
41 : extern void *ldv_zalloc_unknown_size(void);
42 :
43 : /**
44 : * ldv_xmalloc_unknown_size() - This function is intended just for EMG that likes to pass some size even
45 : * when it wants to allocate memory of unknown size.
46 : */
47 : extern void *ldv_xmalloc_unknown_size(size_t size);
48 1 :
49 : #endif /* __VERIFIER_MEMORY_H */
|