Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jun 2012 18:48:06 +0000
From:      gmiller@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r238595 - in soc2012/gmiller/locking-head: . lib/libwitness
Message-ID:  <20120629184806.A7BD1106564A@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120629184806.A7BD1106564A>