socsvn commit: r238595 - in soc2012/gmiller/locking-head: .
lib/libwitness
gmiller at FreeBSD.org
gmiller at FreeBSD.org
Fri Jun 29 18:48:07 UTC 2012
Author: gmiller
Date: Fri Jun 29 18:48:03 2012
New Revision: 238595
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238595
Log:
r238577 at FreeBSD-dev: root | 2012-06-20 08:44:55 -0500
Fix NULL-pointer issues in graph insertion.
Modified:
soc2012/gmiller/locking-head/ (props changed)
soc2012/gmiller/locking-head/lib/libwitness/graph.c
soc2012/gmiller/locking-head/lib/libwitness/lists.c
Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libwitness/graph.c Fri Jun 29 17:39:40 2012 (r238594)
+++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Fri Jun 29 18:48:03 2012 (r238595)
@@ -73,9 +73,12 @@
static struct graph_node *
lookup_node(void *lock)
{
- struct graph_node *node;
+ struct graph_node *node = NULL;
+
+ if (root != NULL) {
+ node = scan_graph(root, lock);
+ }
- node = scan_graph(root, lock);
if (node == NULL) {
node = malloc(sizeof(struct graph_node));
node->lock = lock;
Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libwitness/lists.c Fri Jun 29 17:39:40 2012 (r238594)
+++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Fri Jun 29 18:48:03 2012 (r238595)
@@ -27,7 +27,7 @@
#include "witness.h"
-_Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head =
+static _Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head =
SLIST_HEAD_INITIALIZER(lock_head);
// XXX: temporary debugging code
@@ -56,8 +56,8 @@
SLIST_INSERT_HEAD(&lock_head, entry, lock_next);
- if (insert_lock(entry, next) < 0) {
- /* XXX: LoR */
+ if (next != NULL && insert_lock(entry, next) < 0) {
+ puts("LoR detected.");
}
printf("inserted lock %p\n", lock);
@@ -74,6 +74,7 @@
if (entry->lock == lock) {
SLIST_REMOVE(&lock_head, entry, lock_entry, lock_next);
free(entry);
+
break;
}
}
More information about the svn-soc-all
mailing list