aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kmemcheck.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kmemcheck.h')
-rw-r--r--include/linux/kmemcheck.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 47b39b7c7e84..e880d4cf9e22 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -34,6 +34,8 @@ void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
34int kmemcheck_show_addr(unsigned long address); 34int kmemcheck_show_addr(unsigned long address);
35int kmemcheck_hide_addr(unsigned long address); 35int kmemcheck_hide_addr(unsigned long address);
36 36
37bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
38
37#else 39#else
38#define kmemcheck_enabled 0 40#define kmemcheck_enabled 0
39 41
@@ -99,6 +101,11 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p,
99{ 101{
100} 102}
101 103
104static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
105{
106 return true;
107}
108
102#endif /* CONFIG_KMEMCHECK */ 109#endif /* CONFIG_KMEMCHECK */
103 110
104/* 111/*
@@ -137,10 +144,15 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p,
137 int name##_end[0]; 144 int name##_end[0];
138 145
139#define kmemcheck_annotate_bitfield(ptr, name) \ 146#define kmemcheck_annotate_bitfield(ptr, name) \
140 do if (ptr) { \ 147 do { \
141 int _n = (long) &((ptr)->name##_end) \ 148 int _n; \
149 \
150 if (!ptr) \
151 break; \
152 \
153 _n = (long) &((ptr)->name##_end) \
142 - (long) &((ptr)->name##_begin); \ 154 - (long) &((ptr)->name##_begin); \
143 BUILD_BUG_ON(_n < 0); \ 155 MAYBE_BUILD_BUG_ON(_n < 0); \
144 \ 156 \
145 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ 157 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
146 } while (0) 158 } while (0)