From mboxrd@z Thu Jan 1 00:00:00 1970 From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers) Date: Sat, 13 Oct 2012 12:44:02 -0400 Subject: [lttng-dev] [PATCH 1/4] test: test for the proper pointer In-Reply-To: <1350144514-4132-1-git-send-email-laijs@cn.fujitsu.com> References: <1350144514-4132-1-git-send-email-laijs@cn.fujitsu.com> Message-ID: <20121013164402.GE29985@Krystal> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote: > 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 merged, thanks! Mathieu > --- > tests/test_urcu_lfs.c | 7 ++++--- > 1 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c > index 88bf65d..681b654 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)++; > } > -- > 1.7.7.6 > -- Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com