diff options
Diffstat (limited to 'include/linux/slab.h')
-rw-r--r-- | include/linux/slab.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 27402fea9b79..0289ec89300a 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -31,6 +31,19 @@ | |||
31 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ | 31 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. | ||
35 | * | ||
36 | * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault. | ||
37 | * | ||
38 | * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can. | ||
39 | * Both make kfree a no-op. | ||
40 | */ | ||
41 | #define ZERO_SIZE_PTR ((void *)16) | ||
42 | |||
43 | #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) < \ | ||
44 | (unsigned long)ZERO_SIZE_PTR) | ||
45 | |||
46 | /* | ||
34 | * struct kmem_cache related prototypes | 47 | * struct kmem_cache related prototypes |
35 | */ | 48 | */ |
36 | void __init kmem_cache_init(void); | 49 | void __init kmem_cache_init(void); |