All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
To: qemu-devel@nongnu.org
Subject: [PATCH] tests: Fix a bug with count variables
Date: Fri,  7 Feb 2020 19:54:33 +0800	[thread overview]
Message-ID: <20200207115433.118254-1-tianjia.zhang@linux.alibaba.com> (raw)

The counting code here should use the local variable n_nodes_local.
Otherwise, the variable n_nodes is counting incorrectly, causing the
counting logic of the code to be wrong.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 tests/test-rcu-list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test-rcu-list.c b/tests/test-rcu-list.c
index 6f076473e0..c0fc47ded4 100644
--- a/tests/test-rcu-list.c
+++ b/tests/test-rcu-list.c
@@ -219,7 +219,7 @@ static void *rcu_q_updater(void *arg)
             j++;
             if (target_el == j) {
                 struct list_element *new_el = g_new(struct list_element, 1);
-                n_nodes += n_nodes_local;
+                n_nodes_local++;
                 TEST_LIST_INSERT_AFTER_RCU(el, new_el, entry);
                 break;
             }
-- 
2.17.1



             reply	other threads:[~2020-02-07 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 11:54 Tianjia Zhang [this message]
2020-02-12 13:59 ` [PATCH] tests: Fix a bug with count variables Stefan Hajnoczi
     [not found]   ` <6a59cc95-4c75-6b36-eaf7-c5a5d2ecdf2d@linux.alibaba.com>
2020-03-06 10:59     ` Tianjia Zhang
2020-03-06 10:53 ` Stefan Hajnoczi
2020-03-06 11:44   ` Tianjia Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200207115433.118254-1-tianjia.zhang@linux.alibaba.com \
    --to=tianjia.zhang@linux.alibaba.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.