From: Lai Jiangshan Date: Sat, 13 Oct 2012 16:41:17 +0000 (-0400) Subject: test_urcu_lfs: test for the proper pointer X-Git-Tag: v0.8.0~191 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f3eb6ef162778c396fcffefda3f3379fce5cab17;p=userspace-rcu.git test_urcu_lfs: test for the proper pointer We should use "if (snode)" instead of "if (node)" in case of the struct cds_lfs_node_rcu is not the first field of struct node. Signed-off-by: Lai Jiangshan Signed-off-by: Mathieu Desnoyers --- diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c index 5886ce8..99d1b4c 100644 --- a/tests/test_urcu_lfs.c +++ b/tests/test_urcu_lfs.c @@ -242,13 +242,14 @@ void *thr_dequeuer(void *_count) for (;;) { struct cds_lfs_node_rcu *snode; - struct test *node; rcu_read_lock(); snode = cds_lfs_pop_rcu(&s); - node = caa_container_of(snode, struct test, list); rcu_read_unlock(); - if (node) { + if (snode) { + struct test *node; + + node = caa_container_of(snode, struct test, list); call_rcu(&node->rcu, free_node_cb); URCU_TLS(nr_successful_dequeues)++; }