Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcu: Make bugginess of code sample more evident

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>

+2 -2
+2 -2
Documentation/RCU/whatisRCU.txt
··· 265 265 rcu_read_lock(); 266 266 p = rcu_dereference(head.next); 267 267 rcu_read_unlock(); 268 - x = p->address; 268 + x = p->address; /* BUG!!! */ 269 269 rcu_read_lock(); 270 - y = p->data; 270 + y = p->data; /* BUG!!! */ 271 271 rcu_read_unlock(); 272 272 273 273 Holding a reference from one RCU read-side critical section