rcu: Make bugginess of code sample more evident
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 12 Feb 2013 15:56:27 +0000 (07:56 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 12 Mar 2013 21:09:01 +0000 (14:09 -0700)
One of the code samples in whatisRCU.txt shows a bug, but someone scanning
the document quickly might mistake it for a valid use of RCU.  Add some
screaming comments to help keep speed-readers on track.

Reported-by: Nathan Zimmer <nzimmer@sgi.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/RCU/whatisRCU.txt

index 0cc7820967f4b54213918e6e21bb7e3cb952d141..10df0b82f45939a91aec83c450b6713c6cafdc18 100644 (file)
@@ -265,9 +265,9 @@ rcu_dereference()
                rcu_read_lock();
                p = rcu_dereference(head.next);
                rcu_read_unlock();
-               x = p->address;
+               x = p->address; /* BUG!!! */
                rcu_read_lock();
-               y = p->data;
+               y = p->data;    /* BUG!!! */
                rcu_read_unlock();
 
        Holding a reference from one RCU read-side critical section