summaryrefslogtreecommitdiff
path: root/include/linux/kmemcheck.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kmemcheck.h')
-rw-r--r--include/linux/kmemcheck.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index dc2fd545db00..e880d4cf9e22 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -144,10 +144,15 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
int name##_end[0];
#define kmemcheck_annotate_bitfield(ptr, name) \
- do if (ptr) { \
- int _n = (long) &((ptr)->name##_end) \
+ do { \
+ int _n; \
+ \
+ if (!ptr) \
+ break; \
+ \
+ _n = (long) &((ptr)->name##_end) \
- (long) &((ptr)->name##_begin); \
- BUILD_BUG_ON(_n < 0); \
+ MAYBE_BUILD_BUG_ON(_n < 0); \
\
kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
} while (0)