aboutsummaryrefslogtreecommitdiff
path: root/lib/classifier.h
diff options
context:
space:
mode:
authorAlex Wang <alexw@nicira.com>2013-07-22 09:19:56 -0700
committerBen Pfaff <blp@nicira.com>2013-07-22 11:20:43 -0700
commit55d2690646769467b6d26ad55516ff6eeb12869d (patch)
tree19b86a6ef64c96d9a1a98ff53863062b21c8d7e3 /lib/classifier.h
parent21a0e105f175926d1d10d324565915ccb96fd28b (diff)
clang: Fix segfault in unit tests.
It seems that 'clang' compiler applies strict protection on pointer dereference. And it causes unexpected execution in macro functions like "HMAP_FOR_EACH()" and unit test failures. This commit fixes this issue and pass all unit tests. Co-authored-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/classifier.h')
-rw-r--r--lib/classifier.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/classifier.h b/lib/classifier.h
index fdc3af7a..09b3a131 100644
--- a/lib/classifier.h
+++ b/lib/classifier.h
@@ -124,13 +124,13 @@ struct cls_rule *cls_cursor_next(struct cls_cursor *, struct cls_rule *);
#define CLS_CURSOR_FOR_EACH(RULE, MEMBER, CURSOR) \
for (ASSIGN_CONTAINER(RULE, cls_cursor_first(CURSOR), MEMBER); \
- &(RULE)->MEMBER != NULL; \
+ RULE != OBJECT_CONTAINING(NULL, RULE, MEMBER); \
ASSIGN_CONTAINER(RULE, cls_cursor_next(CURSOR, &(RULE)->MEMBER), \
MEMBER))
#define CLS_CURSOR_FOR_EACH_SAFE(RULE, NEXT, MEMBER, CURSOR) \
for (ASSIGN_CONTAINER(RULE, cls_cursor_first(CURSOR), MEMBER); \
- (&(RULE)->MEMBER != NULL \
+ (RULE != OBJECT_CONTAINING(NULL, RULE, MEMBER) \
? ASSIGN_CONTAINER(NEXT, cls_cursor_next(CURSOR, &(RULE)->MEMBER), \
MEMBER) \
: 0); \