lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Nov 2016 22:48:19 +0200
From:   "Michael S. Tsirkin" <mst@...hat.com>
To:     David Miller <davem@...emloft.net>,
        "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
        Arnd Bergmann <arnd@...db.de>
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH RFC] hlist_add_tail_rcu disable sparse warning

sparse is unhappy about this code in hlist_add_tail_rcu:

        struct hlist_node *i, *last = NULL;

        for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i))
                last = i;

This is because hlist_next_rcu and hlist_next_rcu return
__rcu pointers.

The following trivial patch disables the warning
without changing the behaviour in any way.

Signed-off-by: Michael S. Tsirkin <mst@...hat.com>

---

I would appreciate review to confirm the function doesn't
do anything unsafe though.

In particular, should this use __hlist_for_each_rcu instead?
I note that __hlist_for_each_rcu does rcu_dereference
internally, which is missing here.

compile-tested only.

diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 8beb98d..33574db 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -511,7 +511,7 @@ static inline void hlist_add_tail_rcu(struct hlist_node *n,
 {
 	struct hlist_node *i, *last = NULL;
 
-	for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i))
+	for (i = h->first; i; i = i->next)
 		last = i;
 
 	if (last) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ