From patchwork Fri Oct 21 22:55:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1312 Return-Path: Received: from confino.investici.org (investici.nine.ch [217.150.252.179]) by open-mesh.org (Postfix) with ESMTPS id 1B22E60086D for ; Sat, 22 Oct 2011 00:56:40 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [217.150.252.179] (confino [217.150.252.179]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 53250C8653; Fri, 21 Oct 2011 22:56:39 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 confino.investici.org 53250C8653 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1319237799; bh=LVDEXZgI0aCetQyuUnbRTN8+X8nWjSTcUuHA5+p4r8s=; h=From:To:Cc:Subject:Date:Message-Id; b=AxZBSdgk+WuPOtu9ogJv7wqk8AZlbKcxvw2L3W0focJ4VKSN2leTL0ZLAn92ZMxgr NUNn8RK+PEIx49cg3c1ctishNgAkvnmKhFtVuwmxQ9pbs9rM0SnJ7w2cf83eUhVzMR nf2cUaOYyh5LYFSTp5ouITxN3zN2Fgy+MzNqbCIM= From: Antonio Quartulli To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 22 Oct 2011 00:55:39 +0200 Message-Id: <1319237739-7686-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: unify hash_entry field position in tt_local/global_entry X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 22:56:40 -0000 Function tt_response_fill_table() actually uses a tt_local_entry pointer to iterate either over the local or the global table entries (it depends on the what hash table is passed as argument). To iterate over such entries the hlist_for_each_entry_rcu() macro has to access their "hash_entry" field which MUST be at the same position in both the tt_global/local_entry structures. Reported-by: Simon Wunderlich Signed-off-by: Antonio Quartulli --- types.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types.h b/types.h index 1ae3557..ab8d0fe 100644 --- a/types.h +++ b/types.h @@ -224,22 +224,22 @@ struct socket_packet { struct tt_local_entry { uint8_t addr[ETH_ALEN]; + struct hlist_node hash_entry; unsigned long last_seen; uint16_t flags; atomic_t refcount; struct rcu_head rcu; - struct hlist_node hash_entry; }; struct tt_global_entry { uint8_t addr[ETH_ALEN]; + struct hlist_node hash_entry; /* entry in the global table */ struct orig_node *orig_node; uint8_t ttvn; uint16_t flags; /* only TT_GLOBAL_ROAM is used */ unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ atomic_t refcount; struct rcu_head rcu; - struct hlist_node hash_entry; /* entry in the global table */ }; struct tt_change_node {